Subject: Re: [JGIT PATCH 1/1] jgit: create a tag command

From: "Shawn O. Pearce" <[email-masked]>
Date: Sat, 12 Jul 2008 03:42:06 +0000

"Shawn O. Pearce" <[email-masked]> wrote:
> Mike Ralphson <[email-masked]> wrote:
> 
> > > I think we are at the point where we need to either write a
> > > #@!*(!@(! command line option parser, import one, or stop writing
> > > command line programs.  I would certainly appreciate any opinion
> > > you might have on the matter.
> > 
> > a) is a distraction, c) is a backwards step, so maybe b) wins.
> 
> So I looked at GNU getopt and its at least smaller than Apache
> Commons,

Probably the state-of-the-arg is args4j:

  https://args4j.dev.java.net/

It uses Java 5 annotations to setup the argument parsing:

  public class SampleMain {

    @Option(name="-r",usage="recursively run something")
    private boolean recursive;

    @Option(name="-o",usage="output to this file",metaVar="OUTPUT")
    private File out = new File(".");

    @Option(name="-str")        // no usage
    private String str = "(default value)";
  ...

I'm usually not a big fan of reflection, but it may make sense to
take advantage of it in a case like this, and just import args4j
into our command line tools.

args4j is provided under the MIT license.

-- 
Shawn.