Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accepting more than one value for more than one argument causes unexpected result #484

Open
Eliran-Turgeman opened this issue Aug 25, 2020 · 1 comment

Comments

@Eliran-Turgeman
Copy link

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?

stackoverflow post - if you want to answer there also

@TylerTemp
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants