mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Colorize the CLI help text

Open hamdanal opened this issue 2 years ago • 1 comments

Add a ColoredHelpFormatter argparse formatter class that colors the command line arguments of mypy CLI help. The formatter uses the existing FancyFormatter for the coloring itself and the detection of the terminal. It is added to the following commands:

  • mypy
  • stubgen
  • stubtest
  • dmypy and its subcommands

The output has been tested locally with all the commands above in the terminal (coloring enabled) and when piped (coloring disabled). I also tested mypy.api.run to ensure that the proper stdout and stderr are passed and colors are disabled.

Here is a screenshot of mypy --help with the colors: mypy --help

hamdanal avatar Jan 15 '23 22:01 hamdanal

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Jan 16 '23 08:01 github-actions[bot]

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

github-actions[bot] avatar Sep 23 '23 13:09 github-actions[bot]