You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following #1115 it appears the list is now big enough that it can be annoying to handle. Although users can just issue ghcup list | less, other tools such as git by default open a pager, unless the output is part of a pipe.
So I'm proposing the following behavior:
new config option pager: { list: bool, cmd: string }
cmd is optional and can point to a full path or a filename (to be searched for in PATH)
when pager: nil -> paging disabled
when pager: { list: false, ... } -> paging disabled for list
pager: true is a shorthand for pager: { list: true } turning all boolean options true (if there are future ones)
pager: string is a shorthand for pager: { list: true, cmd: string }, turning all boolean options true (if there are future ones)
setting cmd to an empty string will disable paging as well
new cli option ghcup [-p|--paginate|-P|--no-pager]
overwrites config options
lookup of pager in the given order
if cmd for pager config option is set, use it
otherwise check $GHCUP_PAGER env var
otherwise check $PAGER env var
otherwise check the following binaries in order
most
more
less
when to open the pager
default is off
if paging is enabled through pager config option
or if paging is enabled through cli option
when to not open pager (overwrites all other conditions)
if ghcup is run as part of a pipe (e.g. ghcup list | grep foo or bar=$(ghcup list))
or if ghcup list --raw-format is passed
or if no valid pager is found
other remarks
warnings or anything else going to stderr is not shown in the pager
we may want pager for ghcup --help (compare with git --help vs git -h)
setting pager to cat should work too (and just print to stdout)
In the future we may:
switch the default for paging to true (need community input)
but only invoke a pager when the terminal height is less than the output (compare with less -F)
Following #1115 it appears the list is now big enough that it can be annoying to handle. Although users can just issue
ghcup list | less
, other tools such asgit
by default open a pager, unless the output is part of a pipe.So I'm proposing the following behavior:
pager: { list: bool, cmd: string }
cmd
is optional and can point to a full path or a filename (to be searched for in PATH)pager: nil
-> paging disabledpager: { list: false, ... }
-> paging disabled for listpager: true
is a shorthand forpager: { list: true }
turning all boolean optionstrue
(if there are future ones)pager: string
is a shorthand forpager: { list: true, cmd: string }
, turning all boolean optionstrue
(if there are future ones)cmd
to an empty string will disable paging as wellghcup [-p|--paginate|-P|--no-pager]
cmd
forpager
config option is set, use itmost
more
less
pager
config optionghcup list | grep foo
orbar=$(ghcup list)
)ghcup list --raw-format
is passedghcup --help
(compare withgit --help
vsgit -h
)cat
should work too (and just print to stdout)In the future we may:
true
(need community input)less -F
)Useful libraries to check:
The text was updated successfully, but these errors were encountered: