docopt / docopt.c

C-code generator for docopt language.
MIT License
318 stars 46 forks source link

Number of parsed tokens? #28

Open Schnouki opened 10 years ago

Schnouki commented 10 years ago

Hi,

I'm using docopt to parse arguments for my program. This program then calls a library function that accepts argc, argv arguments to do its own argument parsing. And I'd like to be able to call ./my_program --my-arg --my-other-arg -- --lib-arg --other-lib-arg.

Basically, I'd need to be know how many tokens have been parsed by docopt, so that I can pass (argc - parsed_tokens) and [argv[0]] + argv[parsed_tokens:] to that lib (using a Python syntax to be clearer :wink:).

Would it be possible to add something similar to docopt? If I'm the only one interested in such a feature and if I end up writing it, would you be interested in merging it? :)

Thanks!

keleshev commented 10 years ago

Sorry for late reply.

In reference implementation, it is possible to have the following usage:

usage: my_program [--my-arg --my-other-arg] [--] [<args>...]

In this case, you invocation will capture ['--lib-arg', '--other-lib-arg'] as <args>. However, this doesn't seem to be supported in docopt.c currently.

Docopt.c has a bit of a stale period of development right now, so I'm not sure if this is going to be supported soon. @kblomqvist, what do you think?

kblomqvist commented 10 years ago

Unfortunately that's the case (not going to be supported soon (by me)).