When I specify a parameter for argparse with both a short and long name, e.g.:
parser.add_argument("-m", "--min", dest="min_value", type=float, help="Minimum value")
and ask for --help, I get:
-m MIN_VALUE, --min MIN_VALUE
Minimum value
This annoys me. I would like MIN_VALUE not to be repeated. So, for example:
[-m | --min-value] MIN_VALUE
Minimum value
can I get argparse to print that (other than by overriding the --help message entirely)?
You don't have to override the
helpmessage, just create your ownHelpFormatterclass:This way you can adjust the structure of the arguments printed within the help message without having to completely change it.