usql icon indicating copy to clipboard operation
usql copied to clipboard

Unable to set argument to PAGER

Open noborus opened this issue 4 years ago • 5 comments

Commands with no arguments work

\set PAGER 'less'

But it doesn't work with arguments

\set PAGER 'less --header 1'
SELECT * FROM test;
error: pq: exec: "less --header 1": executable file not found in $PATH

It was an example using less, but I am developing a pager and would like to specify many options to use it.

\set PAGER'ov -C -d "|" -H1 -F'

noborus avatar Dec 26 '21 02:12 noborus

As a workaround, can you try using an alias or creating a wrapper script?

nineinchnick avatar Dec 26 '21 17:12 nineinchnick

Of course, workarounds are possible. But I would like to show the user the best way to configure the pager. I think it's better to just write one line in the config file.

noborus avatar Dec 26 '21 22:12 noborus

Sure, this is a valid issue/request, especially since it looks like psql allows to use a pager with arguments.

nineinchnick avatar Dec 26 '21 23:12 nineinchnick

I sent a pull request to xo/tblfmt. Please let me know if you have any problems.

noborus avatar Aug 24 '22 07:08 noborus

@noborus That is a great job. I did a very simple test and it looks good for me.

renard avatar Sep 19 '22 14:09 renard

Please note that less has the LESS environment variable. This would have always worked by setting LESS in your shell environment.

$ export LESS='-S -I -R'

kenshaw avatar Apr 01 '24 00:04 kenshaw