In git I can use:
git config --global core.pager "less -FX"
This will:
- When an output is longer (like
git log) than a single page a pager (less) is used - When output is short, it is not
Is there a configuration like this for kubectl?
In git I can use:
git config --global core.pager "less -FX"
This will:
git log) than a single page a pager (less) is usedIs there a configuration like this for kubectl?
Copyright © 2021 Jogjafile Inc.
You could always wrap it in a function.
If you are happy with this solution, you can save it to your shell's interactive startup file.
A problem with the pipe to
lessis that it will mask the exit status of the actualkubectlcommand. In Bash, you could addreturn ${PIPESTATUS[0]}to the end of the function, before the closing brace.