Open acornejo opened 9 years ago
I noticed that same problem.
As stated in README.md, only options are supported at the moment.
Example of program execution in my fork. Of course, my python experience is lacking so it's probably not the cleanest solution. My fork also support options before or after positional arguments.
$ ./example -h
Naval Fate.
Usage:
naval_fate.py ship create <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 anchor [--up] [<number>]
naval_fate.py --help
naval_fate.py --version
Options:
-h --help Show this screen.
--version Show version.
--speed=<kn> Speed in knots [default: 10].
--moored Moored (anchored) mine.
--drifting Drifting mine.
$ ./example ship test move 4 5 --speed=20
Commands
mine == false
move == true
create == false
remove == false
set == false
ship == true
shoot == false
anchor == false
Arguments
name == test
x == 4
y == 5
number == (null)
Flags
--drifting == false
--help == false
--moored == false
--up == false
--version == false
Options
--speed == 20
I tried docopt.c for the first time today.
Running the example doesn't work, for example, see the following output:
As you can see, the move command and the --speed option were read correctly, but the
<x>
and<y>
arguments were NOT populated.