I would like to have the following syntax:
python utility.py file1 FILE1 file2 FILE2
where file1 and file2 are optional arguments. It is simple to make it working with this syntax:
python utility.py --file1 FILE1 --file2 FILE2
using
parser.add_argument('--file1',type=file)
parser.add_argument('--file2',type=file)
however, if I remove the dashes, argparse starts to interprete it as a positional rather than optional argument...
In other words, is it possible to specifically tell argparse whether an argument is optional or positional so that I can have optional parameters without the dashes?