Most of these types are common in our command line tools and we will want to use them over and over again. So we can register them in our class initializer and be certain they get associated to an instance member automatically by type. Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- .../org/spearce/jgit/pgm/opt/CmdLineParser.java | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/CmdLineParser.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/CmdLineParser.java index 257d88f..62197e4 100644 --- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/CmdLineParser.java +++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/opt/CmdLineParser.java @@ -43,9 +43,14 @@ import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.IllegalAnnotationError; import org.kohsuke.args4j.Option; +import org.spearce.jgit.lib.ObjectId; import org.spearce.jgit.lib.Repository; import org.spearce.jgit.pgm.TextBuiltin; +import org.spearce.jgit.revwalk.RevCommit; +import org.spearce.jgit.revwalk.RevTree; import org.spearce.jgit.revwalk.RevWalk; +import org.spearce.jgit.transport.RefSpec; +import org.spearce.jgit.treewalk.AbstractTreeIterator; /** * Extended command line parser which handles --foo=value arguments. @@ -56,6 +61,15 @@ import org.spearce.jgit.revwalk.RevWalk; * args4j style format prior to invoking args4j for parsing. */ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { + static { + registerHandler(AbstractTreeIterator.class, + AbstractTreeIteratorHandler.class); + registerHandler(ObjectId.class, ObjectIdHandler.class); + registerHandler(RefSpec.class, RefSpecHandler.class); + registerHandler(RevCommit.class, RevCommitHandler.class); + registerHandler(RevTree.class, RevTreeHandler.class); + } + private final Repository db; private RevWalk walk; -- 1.5.6.3.569.ga9185 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html