I would like to use batcat
to colorize the output of the --help
and -h
options of commands, similar to the use of batcat
colorization of the man pages.
I would like this to work on different shells, including Bash and Zsh.
There is a solution for the manpages where within the .*rc
file (.bashrc
or .zshrc
) is added:
export MANPAGER="sh -c 'col -bx | batcat -l man -p'"
export MANROFFOPT="-c"
Is there an environment variable that can be used in a similar way for the --help
/-h
option?
Writing a function for it or piping it after every --help
/-h
query, like | bat -l help
, doesn't look to be the most "beautiful" way to do this.
--help
in their own ways, there's no standard (except maybe for GNU commands, but even then only for formatting and conventions). Many don't even have--help
, but only-h
, for instance, and a few pipe the output to a pager automatically (e.g.,aws
CLI), most dump the text to stderr but some output to stdout, etc., etc.