I'm trying to implement a python3 CLI using the docopt
package. I'm trying to get my program accept multiple positional input files and, optionally a list of output files.
A MWE for my docstring is:
__doc__ = """
Usage:
test.py [INPUT...] [-o OUTPUT...] [-t TEST]
Options:
-o OUTPUT..., --output OUTPUT... #One output file for each INPUT file [default: DEFAULT]
-t TEST, --test TEST #A test option
"""
For example a programm call as
test.py FILE_A FILE_B -o OUTFILE_A OUTFILE B -t true
Should return a dict:
{'--output': ['OUTFILE_A', 'OUTFILE_B'],
'--test': 'true',
'INPUT': ['FILE_A', 'FILE_B']}
but for some reason it is always appended to the INPUT arguments:
{'--output': ['OUTFILE_A'],
'--test': 'true',
'INPUT': ['FILE_A', 'FILE_B', 'OUTFILE_B']}