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

arguments not working #32

Open
acornejo opened this issue Jan 7, 2015 · 3 comments
Open

arguments not working #32

acornejo opened this issue Jan 7, 2015 · 3 comments

Comments

@acornejo
Copy link

acornejo commented Jan 7, 2015

I tried docopt.c for the first time today.

Running the example doesn't work, for example, see the following output:

$ ./example ship test move 4 5 --speed=20
Commands
    mine == false
    move == true
    create == false
    remove == false
    set == false
    ship == true
    shoot == false
Arguments
    x == (null)
    y == (null)
Flags
    --drifting == false
    --help == false
    --moored == false
    --version == false
Options
    --speed == 20

As you can see, the move command and the --speed option were read correctly, but the <x> and <y> arguments were NOT populated.

@noisygecko
Copy link

I noticed that same problem.

@OzgurEraslan
Copy link

As stated in README.md, only options are supported at the moment.
and are positional arguments.

README.md:

Note, at this point the code generator handles only options (positional arguments, commands and pattern matching will follow).

@jkcko
Copy link

jkcko commented Jul 23, 2018

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

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

4 participants