[v2] cli_pager ignored when viewing help in favor of more.com
- Dominant language
- Python
- Stars
- 17.3k
- Forks
- 4.6k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 13
Description
### Describe the bug
I'm spending a lot of time reading the `help` output of various subcommands. Unfortunately, the default pager on Windows is `more.com` with a feature set that's... less than stellar. I've been trying unsuccessfully to get it to use `less` that I've been using under Linux and Cygwin for years.
### Expected Behavior
Based on https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html#cli-usage-pagination-clientside I would ideally like to set `cli_pager` to the installation of less, and then if I need to pipe output to other things I can use --no-cli-pager as needed. (Someday I'll undoubtedly turn off pagination by default and then turn it on as needed, but right now I'd like it active. Obviously when scripting I pass --no-cli-pager no matter what.)
It's surprisingly difficult to find examples via google of setting this key to anything other than an empty string, which I suppose reflects how many experienced AWS users are out there as opposed to relative new users.
### Current Behavior
The `cli_pager` setting has been completely ignored no matter what I assign to it. I have verified that the config file is in fact being used, e.g.,
[default]
just some gibberish here to see what happens
region = us-east-2
output = json
cli_pager =
will correctly produce a parse failure, so I'm editing the correct place. It's only the `cli_pager` key itself.
### Reproduction Steps
Passing the `--debug` option to the CLI turns on a line for "awscli.help" which is crucial here.
With no PAGER or AWS_PAGER in the environment and the config entry for the default profile reading any of the following
cli_pager =
cli_pager = less.exe
cli_pager = D:/full/path/to/cygwin/installation/bin/less.exe
cli_pager = khrsdhksdfhskuhseuhoerw0ejwfe
the debug line is ` MainThread - awscli.help - DEBUG - Running command: ['more']`. No errors were printed in normal output nor in the debug lines, not even anything about "unable to find paging program khrsdhksdfhskuhseuhoerw0ejwfe on line 4, what are you smoking?".
Setting `PAGER=D:/full/path/to/cygwin/installation/bin/less.exe` made everything work. All four combinations above correctly used less, and as expected the debug line is `MainThread - awscli.help - DEBUG - Running command: ['D:/Data/cygwin64/bin/less.exe']`.
Setting `AWS_PAGER=` was ignored entirely. Same four combinations, just defaulted to ` MainThread - awscli.help - DEBUG - Running command: ['more']` with no errors or other debug output. No visible indication that this env variable is even being read, which is kind of disappointing in the 4th deliberate-gibberish case.
### Possible Solution
Using `PAGER` works to specify a pagination binary, including turning it off entirely.
### Additional Information/Context
_No response_
### CLI version used
aws-cli/2.2.4 Python/3.8.8 Windows/10 exe/AMD64 prompt/off
### Environment details (OS name and version, etc.)
Windows 10, tested with both CMD.EXE and Bash
Contributor guide
Assessment
This issue has not been assessed yet.