Please consider switching from using a pager by default to making it opt-in. It's great to have the option, just don't force it on everyone. It could be added to aws config
and the user could be asked about it on first setup. Please reconsider.
It's not too late. The pain and confusion caused by this change is not worth the small benefit IMO. Especially since it's not working as intended. There are many combinations out there that are not Linux and bash.
Is your feature request related to a problem? Please describe.
I'm using Mac and zsh. My ~/.aws/credentials contains multiple profiles and "default" is not used.
aws-cli version is: aws-cli/2.0.28 Python/3.7.4 Darwin/19.5.0 botocore/2.0.0dev32
Command used to test: aws --profile myprofile elasticache create-snapshot --cache-cluster-id mycluster --snapshot-name deleteme
cli_pager=
in [default]
doesn't work when using another profile. Which means I'd have to set it in every profile on every host.AWS_PAGER=""
in ~/.zprofile (zsh) doesn't work for some reason. Setting AWS_PAGER="None"
doesn't work either, it still pipes through less. I checked that the variable is set with set | grep AWS_PAGER
. Note that $PAGER is also set, to less.Describe the solution you'd like
Turn off using a pager by default, leave it as an option.
Additional context
I realize there are ways to "fix" it or work around this new "feature". We could add instructions to new releases that use aws-cli v2. We can change all the scripts we have and set AWS_PAGER in them. Get fancy and try to detect if a tty is present and set accordingly.
But why? Serious question, what is the reasoning behind this breaking change, considering the amount of work we need to do to acomodate it? Personally I see the CLI as being used mainly in scripts, if I want an interactive experience I go to the web console.
Hi @bgdnlp, thanks for the report and the details about your experience and your environment. There's another open issue related to this (#5102) regarding the defaults for this feature.
I am surprised that the AWS_PAGER
environment variable isn't working for you. I am also using OSX and the zsh shell, and adding export AWS_PAGER=""
to my ~/.zprofile
suppresses paging. Here's what I see for my env variables:
> set | grep PAGER
AWS_PAGER=''
PAGER=less
I'm going to leave this open as a feature request for now, as you have provided a number of good talking points.
I've seen that issue, and the others, but we're asking for different things. What @QuinnyPig is asking for is good for an interactive tool like "git log", my point is that interactive use is not the main use case for aws-cli, unlike "git log".
Even where it is used interactively, the paging behavior is not always wanted (see less defaults [1] and the comments on the linked issue). Also, isatty() might not be entirely reliable on other operating systems, for example on Windows. There are probably more corner cases.
You could add a switch like --use-pager
so that people who want it can set aliases in their shell. Honor the setting in config and AWS_PAGER. Tell people about it on first use and in the docs. But please reconsider making it a default because there's too much of an impact on existing tools.
About zsh, I don't know, maybe it behaves differently for different commands? That's why I mentioned what command I'm using to test. I can make it a bug report if it's a bug. This is what I'm using, slightly redacted:
~ 禄 aws --version
aws-cli/2.0.28 Python/3.7.4 Darwin/19.5.0 botocore/2.0.0dev32
~ 禄 set | grep PAGER
AWS_PAGER=''
PAGER=less
~ 禄 aws --profile my-profile elasticache create-snapshot --snapshot-name mysnapshot --cache-cluster-id myredis
~ 禄
There's no output because it goes to less which doesn't print it to console.
--
[1] For anyone looking, the -X
option will cause less to NOT clear the screen when it quits. Which means you can still scroll up to find older aws-cli output and copy&paste. -X
can be sent to less by default by adding it to the value of LESS
env var. This is set by default on some Linuxes. -R
and -F
might also be desirable.
Cross referencing: I've submitted a PR that changes this behavior from _default_ to _opt-in_. See #5398
Please reconsider this change, it is _so_ disruptive. My usage of the AWS CLI is split pretty evenly between interactive use and automation scripting. I now have to work where, and in what cases, and how, I need to set or unset a combination of environment variables or configurations option to get the behaviour I want.
Alternatively, if this behaviour is opt-in, most of the I can leave everything as default, and in the rare cases I need to page the CLI output, I have a solution to that: I can pipe it through a pager.
Please look at this again.
Most helpful comment
Please reconsider this change, it is _so_ disruptive. My usage of the AWS CLI is split pretty evenly between interactive use and automation scripting. I now have to work where, and in what cases, and how, I need to set or unset a combination of environment variables or configurations option to get the behaviour I want.
Alternatively, if this behaviour is opt-in, most of the I can leave everything as default, and in the rare cases I need to page the CLI output, I have a solution to that: I can pipe it through a pager.
Please look at this again.