hamdanal / rich-argparse

A rich help formatter for argparse
https://pypi.org/project/rich-argparse/
MIT License
129 stars 11 forks source link

`RichHelpFormatter` does not work with `argparse.ArgumentDefaultsHelpFormatter` #13

Closed hamdanal closed 2 years ago

hamdanal commented 2 years ago

When the two formatters are used together, the defaults are not printed. Reproducer:

import argparse
from rich_argparse import RichHelpFormatter

class ArgDefRichHelpFormatter(RichHelpFormatter, argparse.ArgumentDefaultsHelpFormatter): ...

parser = argparse.ArgumentParser(formatter_class=ArgDefRichHelpFormatter)
parser.add_argument("--option", default="def", help="help of option")
parser.parse_args()

produces:

usage: t.py [-h] [--option OPTION]

OPTIONAL ARGUMENTS:
  -h, --help       show this help message and exit
  --option OPTION  help of option