Colorize the CLI help text
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 -
dmypyand 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:

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅