import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbosity", action="store_true",
help="Pass the first input parameter with either -f or -d
and the second parameter should be the path of the output file")
parser.add_argument("-o", "--output",help="please give the path of the file")
parser.add_argument("-of", "--format",help="provide the output format")
args = parser.parse_args()
when I issue help on the program like:python arg_parse.py -h,Im getting the following help
python arg_parse.py -h
usage: arg_parse.py [-h] [-v] [-o OUTPUT] [-of FORMAT]
optional arguments:
-h, --help show this help message and exit
-v, --verbosity Pass the first input parameter with either -f or -d
and the second parameter should be the path of the
output file
-o OUTPUT, --output OUTPUT
please give the path of the file
-of FORMAT, --format FORMAT
provide the output format
so if we observe optional arguments in the help message for verbosity and help look same as below:
-h, --help
-v, --verbosity
But for OUTPUT and FORMAT we are getting multiple options which are having redundancy as below:
-o OUTPUT, --output OUTPUT
-of FORMAT, --format FORMAT
so the only difference is I put action parameter in verbosity. Now I need the same options for OUTPUT and FORMAT without action parameter.Please help on this.