https://pantsbuild.org/ logo
p

proud-dentist-22844

09/07/2022, 4:38 PM
Is there a way to make pants use a pager via an env var? I’m trying to record an asciinema of
./pants help goals
but it scrolls by too quickly.
f

fast-nail-55400

09/07/2022, 4:39 PM
./pants help goals | less
?
p

proud-dentist-22844

09/07/2022, 4:40 PM
Yeah, but then that distracts from highlighting pants 😛
./pants help goals | more -r
I want to avoid piping it into the pager.
f

fast-nail-55400

09/07/2022, 4:45 PM
so you want something like what
git help
does when it invokes the pager automatically?
p

proud-dentist-22844

09/07/2022, 4:45 PM
yeah
h

hundreds-father-404

09/07/2022, 4:51 PM
feel free to open a feature request 🙂
f

fast-nail-55400

09/07/2022, 4:51 PM
goal output is made using the
Console
type. The help goal could enable the
Console
type (or some related type) invoking
$PAGER
and then write the output into the pager subprocess
1
^^ very hand wavy sketch of a solution
p

proud-dentist-22844

09/07/2022, 5:17 PM
Aargh. Passing the help through a pager (
less
or
more
) results in bad line breaks (esp noticable with
./pants help targets
. https://asciinema.org/a/519532
How does pants determine where to add line breaks?
w

witty-crayon-22786

09/07/2022, 8:41 PM
by querying the TTY size… but i think that as soon as stdout is piped, it will no longer register as a TTY?
p

proud-dentist-22844

09/07/2022, 8:48 PM
I guess so. The
COLUMNS
variable is correct - does the TTY logic use that? If not, maybe that would be a good fallback if not running under a tty.
💯 1
p

proud-dentist-22844

09/08/2022, 12:59 PM
ooh! Then I could make my window 96 chars wide to avoid the odd output without waiting for any code changes in pants! Thanks for finding that.
👍 1
5 Views