When I'm using argparse, as an example like this:
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-i", "--input", action="store")
then the help menu is like this:
usage: test.py [-h] [-i INPUT]
options:
-h, --help show this help message and exit
-i INPUT, --input INPUT
input file
What should I do if I don't want the --input INPUT
here? Like this:
usage: test.py [-h] [-i INPUT]
options:
-h, --help show this help message and exit
-i INPUT input file
You could have two options with the same destination attribute, and use argparse.SUPPRESS
to suppress the help text for one of them.
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", dest="input", action="store")
parser.add_argument("--input", dest="input", action="store", help=argparse.SUPPRESS)