docopt.c icon indicating copy to clipboard operation
docopt.c copied to clipboard

Number of parsed tokens?

Open Schnouki opened this issue 11 years ago • 2 comments

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!

Schnouki avatar May 14 '14 15:05 Schnouki

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?

keleshev avatar Aug 02 '14 20:08 keleshev

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

kblomqvist avatar Aug 06 '14 18:08 kblomqvist