A formatter_class
for argparse
that deals with ANSI colour escapes. Specifically, this formatter does not count escape characters as displayed characters when wrapping argparse's help text into the terminal.
$ pip install argparse-color-formatter
Pass in argparse_color_formatter.ColorHelpFormatter
to a new argument parser as formatter_class
import argparse
from argparse_color_formatter import ColorHelpFormatter
parser = argparse.ArgumentParser(
formatter_class=ColorHelpFormatter
)
pipenv install --dev
pre-commit install
pre-commit install --hook-type commit-msg
pipenv run build
pipenv run test
ANSI colour escapes using this library's new ColorHelpFormatter
: