-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
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"
Metadata
Metadata
Assignees
Labels
No labels