git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 12, 2008, 03:42 UTC
Message-ID
<20080712034206.GA16101@spearce.org>
In-Reply-To
<20080712030104.GB15838@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> wrote:
Show 11 quoted lines
> Mike Ralphson <mike.ralphson@gmail.com> 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.
Previous: Shawn O. PearceNext: Robin Rosenberg
Message 10 of 13 in “jgit: create a tag command”
  1. 1/1 jgit: create a tag commandRobin Rosenberg, Jul 6, 2008
  2. Robin RosenbergJul 6, 2008
  3. Mike RalphsonJul 10, 2008
  4. Robin RosenbergJul 10, 2008
  5. Differences between git-applu and GNU patch (was: [JGIT PATCH 1/1] jgit: create a tag command)Jakub Narebski, Jul 11, 2008
  6. Shawn O. PearceJul 11, 2008
  7. Robin RosenbergJul 11, 2008
  8. Mike RalphsonJul 11, 2008
  9. Shawn O. PearceJul 12, 2008
  10. Shawn O. PearceJul 12, 2008
  11. Robin RosenbergJul 17, 2008
  12. Shawn O. PearceJul 17, 2008
  13. Robin RosenbergJul 17, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.