Implementing commands, as in "git add [options] <files>"

10 views
Skip to first unread message

Matthieu Scholler

unread,
Jul 20, 2016, 1:23:18 PM7/20/16
to jopt-simple
Hi all,

First thank you Paul for this library. Having a good alternative to parse arguments that doesn't use annotations is welcome. This gives some opportunities to hack things around.

As mentioned in the title, is there a recommended way to implement commands as in "git add [options] <files>"?

For the record, currently I'm creating 1 parser for the root command (git), and another for each command (add, commit). The whole thing feels a little awkward though, especially around the argument validation logic where some of it is taken care by the library, and some by my code.

Thanks all for your help and suggestions,
Matthieu

Julien Nicoulaud

unread,
Sep 14, 2016, 3:46:31 PM9/14/16
to jopt-simple
Hi Matthieu,

I had similar need as you (non-annotation based parsing library with subcommand support), and I finally went with argparse4j. It has other annoyances but it has subcommands support.


Julien

Paul Holser

unread,
Sep 25, 2016, 11:19:23 AM9/25/16
to jopt-simple
Hi Matthieu,

Thanks for your interest in jopt-simple!

I'm open to the idea of subcommand support, but I don't want to over-complicate the API either. I haven't landed on that "sweet spot".

I'd be interested to look at proposals for how to proceed -- maybe a pull request or two!

Cheers,
p

Reply all
Reply to author
Forward
0 new messages