Bump args4j version to 2.0.26
New version has features which be useful for Gerrit core and plugins: * new hidden attribute, specifying to hide it in help message * new depends attribute, specifying the dependent option(s) * multiValued attribute was removed Change-Id: Ic7e9f37231cb83940db50fe3b9efe8ad972108cf
This commit is contained in:
@@ -56,7 +56,7 @@ public class Init extends BaseInit {
|
||||
@Option(name = "--list-plugins", usage = "List available plugins")
|
||||
private boolean listPlugins;
|
||||
|
||||
@Option(name = "--install-plugin", usage = "Install given plugin without asking", multiValued = true)
|
||||
@Option(name = "--install-plugin", usage = "Install given plugin without asking")
|
||||
private List<String> installPlugins;
|
||||
|
||||
@Inject
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
public class PrologShell extends AbstractProgram {
|
||||
@Option(name = "-s", multiValued = true, metaVar = "FILE.pl", usage = "file to load")
|
||||
@Option(name = "-s", metaVar = "FILE.pl", usage = "file to load")
|
||||
private List<String> fileName = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,7 +59,7 @@ class GetCapabilities implements RestReadView<AccountResource> {
|
||||
@Option(name = "--format", usage = "(deprecated) output format")
|
||||
private OutputFormat format;
|
||||
|
||||
@Option(name = "-q", metaVar = "CAP", multiValued = true, usage = "Capability to inspect")
|
||||
@Option(name = "-q", metaVar = "CAP", usage = "Capability to inspect")
|
||||
void addQuery(String name) {
|
||||
if (query == null) {
|
||||
query = Sets.newHashSet();
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class GetChange implements RestReadView<ChangeResource> {
|
||||
private final ChangeJson json;
|
||||
|
||||
@Option(name = "-o", multiValued = true, usage = "Output options")
|
||||
@Option(name = "-o", usage = "Output options")
|
||||
void addOption(ListChangesOption o) {
|
||||
json.addOption(o);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.kohsuke.args4j.Option;
|
||||
public class GetDetail implements RestReadView<ChangeResource> {
|
||||
private final GetChange delegate;
|
||||
|
||||
@Option(name = "-o", multiValued = true, usage = "Output options")
|
||||
@Option(name = "-o", usage = "Output options")
|
||||
void addOption(ListChangesOption o) {
|
||||
delegate.addOption(o);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ListGroups implements RestReadView<TopLevelResource> {
|
||||
@Option(name = "-m", metaVar = "MATCH", usage = "match group substring")
|
||||
private String matchSubstring;
|
||||
|
||||
@Option(name = "-o", multiValued = true, usage = "Output options per group")
|
||||
@Option(name = "-o", usage = "Output options per group")
|
||||
public void addOption(ListGroupsOption o) {
|
||||
options.add(o);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class ListProjects implements RestReadView<TopLevelResource> {
|
||||
@Option(name = "--format", usage = "(deprecated) output format")
|
||||
private OutputFormat format = OutputFormat.TEXT;
|
||||
|
||||
@Option(name = "--show-branch", aliases = {"-b"}, multiValued = true,
|
||||
@Option(name = "--show-branch", aliases = {"-b"},
|
||||
usage = "displays the sha of each project in the specified branch")
|
||||
public void addShowBranch(String branch) {
|
||||
showBranch.add(branch);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class QueryChanges implements RestReadView<TopLevelResource> {
|
||||
private boolean reverse;
|
||||
private EnumSet<ListChangesOption> options;
|
||||
|
||||
@Option(name = "--query", aliases = {"-q"}, metaVar = "QUERY", multiValued = true, usage = "Query string")
|
||||
@Option(name = "--query", aliases = {"-q"}, metaVar = "QUERY", usage = "Query string")
|
||||
private List<String> queries;
|
||||
|
||||
@Option(name = "--limit", aliases = {"-n"}, metaVar = "CNT", usage = "Maximum number of results to return")
|
||||
@@ -53,7 +53,7 @@ public class QueryChanges implements RestReadView<TopLevelResource> {
|
||||
imp.setLimit(limit);
|
||||
}
|
||||
|
||||
@Option(name = "-o", multiValued = true, usage = "Output options per change")
|
||||
@Option(name = "-o", usage = "Output options per change")
|
||||
public void addOption(ListChangesOption o) {
|
||||
options.add(o);
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ import org.kohsuke.args4j.OptionDef;
|
||||
import org.kohsuke.args4j.spi.OneArgumentOptionHandler;
|
||||
import org.kohsuke.args4j.spi.OptionHandler;
|
||||
import org.kohsuke.args4j.spi.Setter;
|
||||
import org.kohsuke.args4j.spi.FieldSetter;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
|
||||
final class ApproveOption implements Option, Setter<Short> {
|
||||
private final String name;
|
||||
@@ -45,6 +47,16 @@ final class ApproveOption implements Option, Setter<Short> {
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] depends() {
|
||||
return new String[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hidden() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends OptionHandler<Short>> handler() {
|
||||
return Handler.class;
|
||||
@@ -55,11 +67,6 @@ final class ApproveOption implements Option, Setter<Short> {
|
||||
return "N";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean multiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return name;
|
||||
@@ -84,6 +91,16 @@ final class ApproveOption implements Option, Setter<Short> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldSetter asFieldSetter() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotatedElement asAnnotatedElement() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addValue(final Short val) {
|
||||
this.value = val;
|
||||
|
||||
@@ -62,12 +62,12 @@ final class Receive extends AbstractGitCommand {
|
||||
private final Set<Account.Id> reviewerId = new HashSet<Account.Id>();
|
||||
private final Set<Account.Id> ccId = new HashSet<Account.Id>();
|
||||
|
||||
@Option(name = "--reviewer", aliases = {"--re"}, multiValued = true, metaVar = "EMAIL", usage = "request reviewer for change(s)")
|
||||
@Option(name = "--reviewer", aliases = {"--re"}, metaVar = "EMAIL", usage = "request reviewer for change(s)")
|
||||
void addReviewer(final Account.Id id) {
|
||||
reviewerId.add(id);
|
||||
}
|
||||
|
||||
@Option(name = "--cc", aliases = {}, multiValued = true, metaVar = "EMAIL", usage = "CC user on change(s)")
|
||||
@Option(name = "--cc", aliases = {}, metaVar = "EMAIL", usage = "CC user on change(s)")
|
||||
void addCC(final Account.Id id) {
|
||||
ccId.add(id);
|
||||
}
|
||||
|
||||
@@ -70,16 +70,16 @@ final class SetAccountCommand extends BaseCommand {
|
||||
@Option(name = "--inactive", usage = "set account's state to inactive")
|
||||
private boolean inactive;
|
||||
|
||||
@Option(name = "--add-email", multiValued = true, metaVar = "EMAIL", usage = "email addresses to add to the account")
|
||||
@Option(name = "--add-email", metaVar = "EMAIL", usage = "email addresses to add to the account")
|
||||
private List<String> addEmails = new ArrayList<String>();
|
||||
|
||||
@Option(name = "--delete-email", multiValued = true, metaVar = "EMAIL", usage = "email addresses to delete from the account")
|
||||
@Option(name = "--delete-email", metaVar = "EMAIL", usage = "email addresses to delete from the account")
|
||||
private List<String> deleteEmails = new ArrayList<String>();
|
||||
|
||||
@Option(name = "--add-ssh-key", multiValued = true, metaVar = "-|KEY", usage = "public keys to add to the account")
|
||||
@Option(name = "--add-ssh-key", metaVar = "-|KEY", usage = "public keys to add to the account")
|
||||
private List<String> addSshKeys = new ArrayList<String>();
|
||||
|
||||
@Option(name = "--delete-ssh-key", multiValued = true, metaVar = "-|KEY", usage = "public keys to delete from the account")
|
||||
@Option(name = "--delete-ssh-key", metaVar = "-|KEY", usage = "public keys to delete from the account")
|
||||
private List<String> deleteSshKeys = new ArrayList<String>();
|
||||
|
||||
@Option(name = "--http-password", metaVar = "PASSWORD", usage = "password for HTTP authentication for the account")
|
||||
|
||||
@@ -52,10 +52,13 @@ import org.kohsuke.args4j.spi.BooleanOptionHandler;
|
||||
import org.kohsuke.args4j.spi.EnumOptionHandler;
|
||||
import org.kohsuke.args4j.spi.OptionHandler;
|
||||
import org.kohsuke.args4j.spi.Setter;
|
||||
import org.kohsuke.args4j.spi.FieldSetter;
|
||||
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -380,6 +383,16 @@ public class CmdLineParser {
|
||||
return new String[] {"-h"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] depends() {
|
||||
return new String[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hidden() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String usage() {
|
||||
return "display this help text";
|
||||
@@ -400,11 +413,6 @@ public class CmdLineParser {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean multiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean required() {
|
||||
return false;
|
||||
@@ -415,6 +423,16 @@ public class CmdLineParser {
|
||||
return Option.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldSetter asFieldSetter() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnnotatedElement asAnnotatedElement() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Boolean> getType() {
|
||||
return Boolean.class;
|
||||
@@ -422,7 +440,7 @@ public class CmdLineParser {
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return multiValued();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user