If I have a multi-line option description, DocOpt.jl does not correctly group all lines together, it merely grabs the first line, discarding the rest due to this filter!() call removing all lines that do not start with - after strip()'ing. This stops option descriptions such as the following from working properly:
Naval Fate.
Usage:
naval_fate.py ship new <name>...
naval_fate.py ship <name> move <x> <y> [--speed=<kn>]
naval_fate.py ship shoot <x> <y>
naval_fate.py mine (set|remove) <x> <y> [--moored|--drifting]
naval_fate.py -h | --help
naval_fate.py --version
Options:
-h --help Show this screen.
--version Show version.
--speed=<kn> Speed in knots
Has a default value [default: 10].
--moored Moored (anchored) mine.
--drifting Drifting mine.
This is identical to the canonical docopt example except that the --speed option spans multiple lines. When trying it out on try.docopt.org, you can see that --speed is correctly defaulted to 10. However, when running with Julia using this file:
doc = """Naval Fate.
Usage:
naval_fate.py ship new <name>...
naval_fate.py ship <name> move <x> <y> [--speed=<kn>]
naval_fate.py ship shoot <x> <y>
naval_fate.py mine (set|remove) <x> <y> [--moored|--drifting]
naval_fate.py -h | --help
naval_fate.py --version
Options:
-h --help Show this screen.
--version Show version.
--speed=<kn> Speed in knots
Has a default value [default: 10].
--moored Moored (anchored) mine.
--drifting Drifting mine.
"""
using DocOpt
arguments = docopt(doc)
for key in keys(arguments)
println("* $(key): $(arguments[key])")
end
If I have a multi-line option description,
DocOpt.jl
does not correctly group all lines together, it merely grabs the first line, discarding the rest due to thisfilter!()
call removing all lines that do not start with-
afterstrip()
'ing. This stops option descriptions such as the following from working properly:This is identical to the canonical docopt example except that the
--speed
option spans multiple lines. When trying it out on try.docopt.org, you can see that--speed
is correctly defaulted to10
. However, when running with Julia using this file:It does not print out the default value properly: