diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2016-08-22 10:25:30 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2017-08-30 03:07:35 +0200 |
commit | 3af57b52a3dcdfab5ca38eca0972f02c20000e5f (patch) | |
tree | 315e753a26c77adfc16f92a20a300e7f37644200 /org.eclipse.jgit.pgm/src | |
parent | c02c9e80421f2da7391dac658030f9675d665c3a (diff) | |
download | jgit-3af57b52a3dcdfab5ca38eca0972f02c20000e5f.tar.gz jgit-3af57b52a3dcdfab5ca38eca0972f02c20000e5f.zip |
Update args4j to 2.33
CQ: 11068
Change-Id: I7d52cddacff05477f646fda5f7b9f2de844922f6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
5 files changed, 14 insertions, 31 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java index c2f3c4675a..b5cf56e938 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java @@ -77,7 +77,7 @@ class Checkout extends TextBuiltin { @Argument(required = false, index = 0, metaVar = "metaVar_name", usage = "usage_checkout") private String name; - @Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = RestOfArgumentsHandler.class) + @Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class) private List<String> paths = new ArrayList<>(); @Override diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java index 9cee37b791..4c19883c83 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Reset.java @@ -69,7 +69,7 @@ class Reset extends TextBuiltin { private String commit; @Argument(required = false, index = 1, metaVar = "metaVar_paths") - @Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = RestOfArgumentsHandler.class) + @Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class) private List<String> paths = new ArrayList<>(); @Override diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java index 5b691f60d9..6b0744d51a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java @@ -124,7 +124,7 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { private String followPath; @Argument(index = 0, metaVar = "metaVar_commitish") - private final List<RevCommit> commits = new ArrayList<>(); + private List<RevCommit> commits = new ArrayList<>(); @Option(name = "--", metaVar = "metaVar_path", handler = PathTreeFilterHandler.class) protected TreeFilter pathFilter = TreeFilter.ALL; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java index b7f5e58285..adcfea4dc3 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java @@ -83,7 +83,7 @@ class Status extends TextBuiltin { protected String untrackedFilesMode = "all"; // default value //$NON-NLS-1$ @Argument(required = false, index = 0, metaVar = "metaVar_paths") - @Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = RestOfArgumentsHandler.class) + @Option(name = "--", metaVar = "metaVar_paths", handler = RestOfArgumentsHandler.class) protected List<String> filterPaths; @Override diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java index 020b62580f..3dcb2a3147 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java @@ -47,7 +47,6 @@ import java.io.IOException; import java.io.Writer; import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.ResourceBundle; @@ -68,6 +67,7 @@ import org.kohsuke.args4j.IllegalAnnotationError; import org.kohsuke.args4j.NamedOptionDef; import org.kohsuke.args4j.Option; import org.kohsuke.args4j.OptionDef; +import org.kohsuke.args4j.OptionHandlerRegistry; import org.kohsuke.args4j.spi.OptionHandler; import org.kohsuke.args4j.spi.RestOfArgumentsHandler; import org.kohsuke.args4j.spi.Setter; @@ -82,13 +82,14 @@ import org.kohsuke.args4j.spi.Setter; */ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { static { - registerHandler(AbstractTreeIterator.class, + OptionHandlerRegistry registry = OptionHandlerRegistry.getRegistry(); + registry.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); - registerHandler(List.class, OptionWithValuesListHandler.class); + registry.registerHandler(ObjectId.class, ObjectIdHandler.class); + registry.registerHandler(RefSpec.class, RefSpecHandler.class); + registry.registerHandler(RevCommit.class, RevCommitHandler.class); + registry.registerHandler(RevTree.class, RevTreeHandler.class); + registry.registerHandler(List.class, OptionWithValuesListHandler.class); } private final Repository db; @@ -267,8 +268,8 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { class MyOptionDef extends OptionDef { public MyOptionDef(OptionDef o) { - super(o.usage(), o.metaVar(), o.required(), o.handler(), o - .isMultiValued()); + super(o.usage(), o.metaVar(), o.required(), o.help(), o.hidden(), + o.handler(), o.isMultiValued()); } @Override @@ -300,24 +301,6 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { } - @SuppressWarnings("unchecked") - private List<OptionHandler> getOptions() { - List<OptionHandler> options = null; - try { - Field field = org.kohsuke.args4j.CmdLineParser.class - .getDeclaredField("options"); //$NON-NLS-1$ - field.setAccessible(true); - options = (List<OptionHandler>) field.get(this); - } catch (NoSuchFieldException | SecurityException - | IllegalArgumentException | IllegalAccessException e) { - // ignore - } - if (options == null) { - return Collections.emptyList(); - } - return options; - } - @Override public void printSingleLineUsage(Writer w, ResourceBundle rb) { List<OptionHandler> options = getOptions(); |