use of org.kohsuke.args4j.Argument in project buck by facebook.
the class SuggestCommand method runWithoutHelp.
/**
* Normalizes the sole build target argument and partitions it using a
* {@link FineGrainedJavaDependencySuggester}.
*/
@Override
public int runWithoutHelp(final CommandRunnerParams params) throws IOException, InterruptedException {
final Console console = params.getConsole();
if (arguments.size() != 1) {
console.printErrorText("Must specify exactly one argument to 'buck suggest'.");
return 1;
}
String targetToBreakDown = Iterables.getOnlyElement(arguments);
final String fullyQualifiedTarget = Iterables.getOnlyElement(getCommandLineBuildTargetNormalizer(params.getBuckConfig()).normalize(targetToBreakDown));
JavaBuildGraphProcessor.Processor processor = (graph, javaDepsFinder, executorService) -> {
BuildTarget buildTarget = params.getBuckConfig().getBuildTargetForFullyQualifiedTarget(fullyQualifiedTarget);
FineGrainedJavaDependencySuggester suggester = new FineGrainedJavaDependencySuggester(buildTarget, graph, javaDepsFinder, console);
suggester.suggestRefactoring();
};
try {
JavaBuildGraphProcessor.run(params, this, processor);
} catch (JavaBuildGraphProcessor.ExitCodeException e) {
return e.exitCode;
}
return 0;
}
use of org.kohsuke.args4j.Argument in project newts by OpenNMS.
the class MergeSort method createCmdLineParser.
private CmdLineParser createCmdLineParser() {
return new CmdLineParser(this) {
@SuppressWarnings("rawtypes")
@Override
public void addArgument(final Setter setter, Argument a) {
Setter newSetter = setter;
if (setter instanceof MethodSetter) {
newSetter = new Setter() {
@SuppressWarnings("unchecked")
@Override
public void addValue(Object value) throws CmdLineException {
setter.addValue(value);
}
@Override
public Class getType() {
return setter.getType();
}
@Override
public boolean isMultiValued() {
return false;
}
@Override
public FieldSetter asFieldSetter() {
return setter.asFieldSetter();
}
@Override
public AnnotatedElement asAnnotatedElement() {
return setter.asAnnotatedElement();
}
};
}
super.addArgument(newSetter, a);
}
};
}
use of org.kohsuke.args4j.Argument in project gerrit by GerritCodeReview.
the class ReviewCommand method addPatchSetId.
@Argument(index = 0, required = true, multiValued = true, metaVar = "{COMMIT | CHANGE,PATCHSET}", usage = "list of commits or patch sets to review")
void addPatchSetId(String token) {
try {
PatchSet ps = psParser.parsePatchSet(token, projectState, branch);
patchSets.add(ps);
} catch (UnloggedFailure e) {
throw new IllegalArgumentException(e.getMessage(), e);
} catch (StorageException e) {
throw new IllegalArgumentException("database error", e);
}
}
Aggregations