Search in sources :

Example 21 with JCommander

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();
}
Also used : JCommander(com.beust.jcommander.JCommander) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 22 with JCommander

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);
}
Also used : JCommander(com.beust.jcommander.JCommander) FileSystem(alluxio.client.file.FileSystem) AlluxioURI(alluxio.AlluxioURI)

Example 23 with JCommander

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));
}
Also used : JCommander(com.beust.jcommander.JCommander) ListHlepCommand(org.jf.baksmali.ListHelpCommand.ListHlepCommand)

Example 24 with JCommander

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();
}
Also used : ListHlepCommand(org.jf.baksmali.ListHelpCommand.ListHlepCommand) Command(org.jf.util.jcommander.Command) JCommander(com.beust.jcommander.JCommander)

Example 25 with JCommander

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));
        }
    }
}
Also used : JCommander(com.beust.jcommander.JCommander)

Aggregations

JCommander (com.beust.jcommander.JCommander)65 ParameterException (com.beust.jcommander.ParameterException)15 IOException (java.io.IOException)10 Map (java.util.Map)6 ParameterDescription (com.beust.jcommander.ParameterDescription)4 FileInputStream (java.io.FileInputStream)3 Console (com.beust.jcommander.internal.Console)2 DefaultCommand (com.evolveum.midpoint.cli.common.DefaultCommand)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Charsets (com.google.common.base.Charsets)2 Throwables (com.google.common.base.Throwables)2 HostAndPort (com.google.common.net.HostAndPort)2 Service (com.google.common.util.concurrent.Service)2 CreationException (com.google.inject.CreationException)2 SystemException (com.torodb.core.exceptions.SystemException)2 BackendPasswordConfig (com.torodb.packaging.config.model.backend.BackendPasswordConfig)2 AbstractDerby (com.torodb.packaging.config.model.backend.derby.AbstractDerby)2 AbstractPostgres (com.torodb.packaging.config.model.backend.postgres.AbstractPostgres)2 AbstractReplication (com.torodb.packaging.config.model.protocol.mongo.AbstractReplication)2 MongoPasswordConfig (com.torodb.packaging.config.model.protocol.mongo.MongoPasswordConfig)2