use of org.kohsuke.args4j.CmdLineParser in project pinot by linkedin.
the class VerifySegmentState method main.
public static void main(String[] args) throws Exception {
VerifySegmentState verifier = new VerifySegmentState();
CmdLineParser cmdLineParser = new CmdLineParser(verifier);
try {
cmdLineParser.parseArgument(args);
} catch (CmdLineException e) {
LOGGER.error("Failed to read command line arguments: ", e);
cmdLineParser.printUsage(System.err);
System.exit(1);
}
verifier.execute();
}
use of org.kohsuke.args4j.CmdLineParser in project pinot by linkedin.
the class QueryRunner method main.
public static void main(String[] args) throws Exception {
QueryRunner queryRunner = new QueryRunner();
CmdLineParser parser = new CmdLineParser(queryRunner);
parser.parseArgument(args);
if (queryRunner._help) {
queryRunner.printUsage();
} else {
queryRunner.execute();
}
}
use of org.kohsuke.args4j.CmdLineParser in project gitblit by gitblit.
the class GitBlitServer4UITests method main.
public static void main(String... args) {
GitBlitServer4UITests server = new GitBlitServer4UITests();
// filter out the baseFolder parameter
List<String> filtered = new ArrayList<String>();
String folder = "data";
for (int i = 0; i < args.length; i++) {
String arg = args[i];
if (arg.equals("--baseFolder")) {
if (i + 1 == args.length) {
System.out.println("Invalid --baseFolder parameter!");
System.exit(-1);
} else if (args[i + 1] != ".") {
folder = args[i + 1];
}
i = i + 1;
} else {
filtered.add(arg);
}
}
Params.baseFolder = folder;
Params params = new Params();
CmdLineParser parser = new CmdLineParser(params);
try {
parser.parseArgument(filtered);
if (params.help) {
server.usage(parser, null);
}
} catch (CmdLineException t) {
server.usage(parser, t);
}
if (params.stop) {
server.stop(params);
} else {
server.start(params);
}
}
use of org.kohsuke.args4j.CmdLineParser in project es6draft by anba.
the class Repl method parseOptions.
private static void parseOptions(Options options, String[] args) {
ParserProperties properties = ParserProperties.defaults().withUsageWidth(128);
CmdLineParser parser = new CmdLineParser(options, properties);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
System.err.println(e.getMessage());
System.err.println(getUsageString(parser, false));
System.exit(1);
}
if (options.showVersion) {
System.out.println(getVersionString());
System.exit(0);
}
if (options.showHelp) {
System.out.println(getUsageString(parser, false));
System.exit(0);
}
if (options.showExtendedHelp) {
System.out.println(getUsageString(parser, true));
System.exit(0);
}
if (options.debug || options.fullDebug || options.debugInfo) {
// Disable interpreter when bytecode is requested
options.noInterpreter = true;
}
if (options.fileName != null) {
// Execute as last script
if (options.fileName.toString().equals("-")) {
// "-" is a short-hand to request reading from System.in
if (System.console() == null) {
// System.in is not interactive
options.evalScripts.add(new EvalString(read(System.in)));
} else {
options.interactive = true;
}
} else {
options.evalScripts.add(new EvalPath(options.fileName));
}
}
if (options.evalScripts.isEmpty()) {
// Default to interactive mode when no files or expressions were set
options.interactive = true;
// Warn if --module is used without input files.
if (options.module) {
System.err.println(formatMessage("module_no_files"));
}
}
if (options.ecmascript7) {
System.err.println(formatMessage("deprecated.es7"));
}
}
use of org.kohsuke.args4j.CmdLineParser 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);
}
};
}
Aggregations