class HelpFormatter(
argparse.RawDescriptionHelpFormatter,
argparse.ArgumentDefaultsHelpFormatter
):
"""Custom formatter class.
- RawDescriptionHelpFormatter indicates that description and epilog
are already correctly formatted and should not be line-wrapped.
- ArgumentDefaultsHelpFormatter will add information about the
default value of each of the arguments.
"""
def __init__(self, *args, **kwargs):
"""Override width default value.
Use the COLUMNS environment variable to define the width,
default to 99 which equal our max line length.
"""
super(HelpFormatter, self).__init__(
*args, width=int(os.environ.get('COLUMNS', 99)), **kwargs
)