Reputation: 63
When you create an parser with argparse there is always a default help menu that looks something along the lines of:
usage: program [-h]
optional arguments:
-h, --help show this help message and exit
For example if I did the following:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--test", help=argparse.SUPPRESS)
parser.parse_args()
And suppressed one of the arguments help messages I would get:
usage: program [-h]
optional arguments:
-h, --help show this help message and exit
How can I suppress the -h/--help
flag as well?
Upvotes: 2
Views: 672
Reputation: 197
You can use the optional keyword argument add_help=False
when you initialize your ArgumentParser
object
https://docs.python.org/3/library/argparse.html#add-help
Upvotes: 3