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

Chaging no-positional arguments order doesn't work #31

Open
ceandrade opened this issue Nov 6, 2020 · 0 comments
Open

Chaging no-positional arguments order doesn't work #31

ceandrade opened this issue Nov 6, 2020 · 0 comments

Comments

@ceandrade
Copy link
Contributor

ceandrade commented Nov 6, 2020

Assume the very simple example:

import DocOpt
doc = """
Usage:
  test_docopt_order.jl -a <arg_a> -b <arg_b>

Options:

    -a <arg_a>  Argument A.
    -b <arg_b>  Argument B.
"""
args = DocOpt.docopt(doc)
@show args

Calling the script with the proposed order works fine:

$ julia docopt_test.jl -a aaaa -b bbbb
args = Dict{String,Any}("-a" => true,"<arg_a>" => "aaaa","-b" => true,"<arg_b>" => "bbbb")

i.e., -a gives us "<arg_a>" => "aaaa" and -b gives us "<arg_b>" => "bbbb".

Now, if we invert the order, things get messy:

$ julia docopt_test.jl -b bbbb -a aaaa
args = Dict{String,Any}("-a" => true,"<arg_a>" => "bbbb","-b" => true,"<arg_b>" => "aaaa")

Note that docopt parse <arg_a> as "bbbb" and <arg_b> as "aaaa".

In other words, it looks like docopt only consider positional arguments.

Julia Version 1.4.0 (2020-03-21)
"DocOpt" => v"0.4.0"

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

1 participant