summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrina Truong <i.chernyavska@gmail.com>2021-03-12 14:14:09 -0800
committerGitHub <noreply@github.com>2021-03-12 14:14:09 -0800
commit954b8c3902b251aeb7a576e275393a2c61644286 (patch)
tree88ac14b1ba725a10ec66f8ff046a3855ccd94e26
parent31ea31d529af0b300a51107de6aa6aaf791c3e99 (diff)
Use configured pager if table format is csv. (#1260)
* Use configured pager if table format is csv. * Changelog. * Simplify.
-rw-r--r--changelog.rst1
-rw-r--r--pgcli/main.py7
2 files changed, 5 insertions, 3 deletions
diff --git a/changelog.rst b/changelog.rst
index 5f270c3e..bc1ad77b 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -15,6 +15,7 @@ Bug fixes:
* Fix crash because of not found `InputMode.REPLACE_SINGLE` with prompt-toolkit < 3.0.6
* Fix comments being lost in config when saving a named query. (#1240)
* Fix IPython magic for ipython-sql >= 0.4.0
+* Fix pager not being used when output format is set to csv. (#1238)
3.1.0
=====
diff --git a/pgcli/main.py b/pgcli/main.py
index 11dbc322..e1c6fc71 100644
--- a/pgcli/main.py
+++ b/pgcli/main.py
@@ -1083,9 +1083,10 @@ class PGCli:
def echo_via_pager(self, text, color=None):
if self.pgspecial.pager_config == PAGER_OFF or self.watch_command:
click.echo(text, color=color)
- elif "pspg" in os.environ.get("PAGER", "") and self.table_format == "csv":
- click.echo_via_pager(text, color)
- elif self.pgspecial.pager_config == PAGER_LONG_OUTPUT:
+ elif (
+ self.pgspecial.pager_config == PAGER_LONG_OUTPUT
+ and self.table_format != "csv"
+ ):
lines = text.split("\n")
# The last 4 lines are reserved for the pgcli menu and padding