1
0
Fork 0

Use configured pager if table format is csv. (#1260)

* Use configured pager if table format is csv.

* Changelog.

* Simplify.
This commit is contained in:
Irina Truong 2021-03-12 14:14:09 -08:00 committed by GitHub
parent 31ea31d529
commit 954b8c3902
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -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
=====

View File

@ -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