I want to use argeparse module in following way,
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('-b', dest='binKey', type=str)
args = parser.parse_args()
# I will make use of args.binKey option in this space
print args.binKey
# After that I want to add -d option to the arguments
parser.add_argument('-d', dest='dir', type=str)
args = parser.parse_args()
With this example, I can only provide -b option as shown below in the help text.
$$ python test.py -h
usage: test.py [-h] [-b BINKEY]
optional arguments:
-h, --help show this help message and exit
-b BINKEY
What I want is I should be able to provide both options while running this code and those options should also by visible in --help option
NOTE: I know that I can provide both options before executing parse_args() once, but that is not the way I want to use my parser.