use of com.beust.jcommander.JCommander in project alluxio by Alluxio.
the class AlluxioFramework method main.
/**
* Starts the Alluxio framework.
*
* @param args command-line arguments
* @throws Exception if the Alluxio framework encounters an unrecoverable error
*/
public static void main(String[] args) throws Exception {
AlluxioFramework framework = new AlluxioFramework();
JCommander jc = new JCommander(framework);
try {
jc.parse(args);
} catch (Exception e) {
System.out.println(e.getMessage());
jc.usage();
System.exit(1);
}
framework.run();
}
use of com.beust.jcommander.JCommander in project alluxio by Alluxio.
the class TestRunner method main.
/**
* Console program that validates the configuration.
*
* @param args there are no arguments needed
* @throws Exception if error occurs during tests
*/
public static void main(String[] args) throws Exception {
TestRunner runner = new TestRunner();
JCommander jCommander = new JCommander(runner, args);
jCommander.setProgramName("TestRunner");
if (runner.mHelp) {
jCommander.usage();
return;
}
AlluxioURI testDir = new AlluxioURI(TEST_PATH);
FileSystem fs = FileSystem.Factory.get();
if (fs.exists(testDir)) {
fs.delete(testDir, DeleteOptions.defaults().setRecursive(true));
}
int ret = runner.runTests();
System.exit(ret);
}
use of com.beust.jcommander.JCommander in project smali by JesusFreke.
the class ListCommand method setupCommand.
@Override
protected void setupCommand(JCommander jc) {
List<JCommander> hierarchy = getCommandHierarchy();
ExtendedCommands.addExtendedCommand(jc, new ListStringsCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListMethodsCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListFieldsCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListTypesCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListClassesCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListDexCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListVtablesCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListFieldOffsetsCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListDependenciesCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListHelpCommand(hierarchy));
ExtendedCommands.addExtendedCommand(jc, new ListHlepCommand(hierarchy));
}
use of com.beust.jcommander.JCommander in project smali by JesusFreke.
the class ListCommand method run.
@Override
public void run() {
JCommander jc = getJCommander();
if (help || jc.getParsedCommand() == null) {
usage();
return;
}
Command command = (Command) jc.getCommands().get(jc.getParsedCommand()).getObjects().get(0);
command.run();
}
use of com.beust.jcommander.JCommander in project smali by JesusFreke.
the class ListHelpCommand method run.
public void run() {
if (commands == null || commands.isEmpty()) {
System.out.println(new HelpFormatter().width(ConsoleUtil.getConsoleWidth()).format(commandAncestors));
} else {
boolean printedHelp = false;
JCommander parentJc = Iterables.getLast(commandAncestors);
for (String cmd : commands) {
JCommander command = ExtendedCommands.getSubcommand(parentJc, cmd);
if (command == null) {
System.err.println("No such command: " + cmd);
} else {
printedHelp = true;
System.out.println(new HelpFormatter().width(ConsoleUtil.getConsoleWidth()).format(((Command) command.getObjects().get(0)).getCommandHierarchy()));
}
}
if (!printedHelp) {
System.out.println(new HelpFormatter().width(ConsoleUtil.getConsoleWidth()).format(commandAncestors));
}
}
}
Aggregations