Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce smarter coloring and --colorize option
By default, do not colorize when stdout is not a tty. The --colorize option, with possible values 'auto', 'always', and 'never' -- defaults to 'auto' when not specified, and registers as 'always' when specified without a value -- is similar to the --color option found in many well known *nix tools, with coreutils ls(1) being a notable example. (Our option is named --colorize since we already have a --colors option.) The old -C, --nocolor option is now a shortcut for --colorize=never. Limitation: due to limitations of Python argparse, specifically not being able to make the equal sign between a long option and its value mandatory, one might expect the following to work: googler --colorize google but it does not, due to "google" being parsed as an argument to --colorize. One has to write googler --colorize -- google instead.
- Loading branch information