Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] cli_pager ignored when viewing help in favor of more.com #6843

Open
Farmbuyer opened this issue Apr 2, 2022 · 3 comments
Open

[v2] cli_pager ignored when viewing help in favor of more.com #6843

Farmbuyer opened this issue Apr 2, 2022 · 3 comments
Labels
documentation This is a problem with documentation. feature-request A feature should be added or improved. p3 This is a minor priority issue pager issues related to AWS_PAGER, cli_pager, or other client-side paging (not API pagination) v2

Comments

@Farmbuyer
Copy link

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 = <various, see below>

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

@Farmbuyer Farmbuyer added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 2, 2022
@Farmbuyer
Copy link
Author

I should add that this bears some similarity to issue 4787 and maybe 5951, but I can't say whether it's actually related or just similar symptoms.

@aaoswal aaoswal self-assigned this Apr 4, 2022
@aaoswal aaoswal added pager issues related to AWS_PAGER, cli_pager, or other client-side paging (not API pagination) and removed needs-triage This issue or PR still needs to be triaged. labels Apr 4, 2022
@aaoswal
Copy link

aaoswal commented Apr 5, 2022

Hi @Farmbuyer,
This is intended behavior.

cli_pager and AWS_PAGER is checked for the output of the AWS commands, not for help documentation.
Instead, PAGER environment variable sets the pager for aws help documentation and takes precedence over cli_pager and AWS_PAGER.

If the intended ask here is to respect cli_pager, this seems to be a duplicate of an active feature-request #4972 for the same.

In the meantime if you want to have the help output be printed directly to stdout, you can use a pipe (i.e. to something like cat) and the CLI will not send it to the pager at all.

$ aws ec2 help | cat

Also, I understand that this can be confusing due to the present documentation and hence, I will mark this as a documentation improvement as well.

Hope this helps!

@aaoswal aaoswal added documentation This is a problem with documentation. needs-review This issue or pull request needs review from a core team member. and removed bug This issue is a bug. needs-review This issue or pull request needs review from a core team member. labels Apr 5, 2022
@Farmbuyer
Copy link
Author

It does help, thank you! And yes, that definitely needs some documentation for clarity. :-)

@tim-finnigan tim-finnigan added feature-request A feature should be added or improved. v2 p3 This is a minor priority issue labels Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a problem with documentation. feature-request A feature should be added or improved. p3 This is a minor priority issue pager issues related to AWS_PAGER, cli_pager, or other client-side paging (not API pagination) v2
Projects
None yet
Development

No branches or pull requests

3 participants