Accepting more than one value for more than one argument causes unexpected result
I have the following docopt __doc__ :
"""gene_sense_distribution_to_csv
Usage:
gene_sense_distribution_to_csv.py <gene> <csv_out> <filenames>... [--min_count=<kn>] [--gene_regions=<kn>]
gene_sense_distribution_to_csv.py -h | --help
gene_sense_distribution_to_csv.py params
gene_sense_distribution_to_csv.py example
Options:
-h --help Shows this screen.
--min_count=<kn> Minimal number of reads in a pileup line in order to consider it in the analysis [default: 0]
--gene_regions=<kn> All the gene regions you want to plot. Options: 5utr, 3utr, exon. The default is all of them. Separate them by space [default: ['5utr', '3utr', 'exon']]
"""
And i'm trying to make --gene_regions argument accept more than one argument like <filenames> does.
I tried to do that by changing this line
gene_sense_distribution_to_csv.py <gene> <csv_out> <filenames>... [--min_count=<kn>] [--gene_regions=<kn>]
To :
gene_sense_distribution_to_csv.py <gene> <csv_out> <filenames>... [--min_count=<kn>] [--gene_regions=<kn>...]
But by trying to execute the command python SCRIPT_NAME GENE OUTPUT_PATH INPUT_PATH --gene_regions exon intron
I get the following args:
{'--gene_regions': ['exon'],
'--help': False,
'--min_count': '0',
'<csv_out>': 'out',
'<filenames>': ['example', 'intron'],
'<gene>': 'Y74C9A.6',
'example': False,
'params': False}
As you can tell, the <filenames> argument got the intron while I meant that --gene_regions would have it.
Is what i'm trying to do currently supported? and if not can it be achieved in any other way?
No. This is not supported by docopt because of the docopt parse tree. Also this is not standrad POSIX cli, because an option flag should only accept none or one arguments.
There is another lib with this feature, but not widly used and verified like docopt