Package com.beust.jcommander

Examples of com.beust.jcommander.JCommander


  protected abstract O getNewOptions();

  private O parseOptions(Args args) {
    O options = getNewOptions();
    new JCommander(options, args.asArray());
    return options;
  }
View Full Code Here


    public static void main(final String[] args)
            throws Exception
    {
        final LoadGeneratorCommandLineConfig config = new LoadGeneratorCommandLineConfig();
        JCommander jCommander = new JCommander(config, args);

        if (config.displayUsage) {
            jCommander.usage();
        } else {
            injector = Guice.createInjector(
                    Stage.PRODUCTION,
                    new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String, String>of())),
                    new LifeCycleModule(),
View Full Code Here

        }
    }

    private static ScrutineerCommandLineOptions parseOptions(String[] args) {
        ScrutineerCommandLineOptions options = new ScrutineerCommandLineOptions();
        new JCommander(options, args);
        return options;
    }
View Full Code Here

    public static void main( String[] args ) throws Exception {
        exit( new ToolRunner().execute( args ) );
    }

    public int execute(String...args) throws Exception {
        JCommander commander = new JCommander(this);
        commander.setProgramName(System.getProperty("app.name"));

        // TODO (low) : this dirty solution has been introduced because it is not possible to
        //              parse arguments ( commander.parse() ) twice.
        final File pluginsDirOption;
        try {
            pluginsDirOption = parsePluginDirOption(args);
        } catch (Exception e) {
            System.err.println(e.getMessage());
            return 1;
        }
        if(pluginsDirOption != null) {
            pluginsDir = pluginsDirOption;
        }

        // add all plugins first
        final Iterator<Tool> tools = getToolsInClasspath();
        while (tools.hasNext()) {
            Tool tool = tools.next();
            commander.addCommand(tool);
        }

        commander.parse(args);

        Map<String, JCommander> commands = commander.getCommands();
        String parsedCommand = commander.getParsedCommand();

        if (printHelp) {
            commander.usage();
            return 0;
        }

        if (showVersion) {
            printVersionInfo();
            return 0;
        }

        if(parsedCommand == null) {
            infoStream.println("A command must be specified.");
            commander.usage();
            return 1;
        }

        if (verbose) {
            LogUtils.setVerboseLogging();
View Full Code Here

  private JCommander parser;
  private BaseCommand command;
  private Map<String, BaseCommand> registeredCommands = Maps.newLinkedHashMap();

  public CommandLine() {
    parser = new JCommander();

    // The ordering of these commands is preserved in help messages
    addCommand("listdatasets", new ListDatasetsCommand());
    addCommand("getdataset", new GetDatasetsCommand());
    addCommand("createdataset", new CreateDatasetCommand());
View Full Code Here

        server.join();
    }

    public static void main(String[] args) throws AgentLoadException {
        RoastOptions opt = new RoastOptions();
        JCommander jc = new JCommander(opt, args);
        jc.setProgramName("warmroast");
       
        if (opt.help) {
            jc.usage();
            System.exit(0);
        }

        System.err.println(SEPARATOR);
        System.err.println("WarmRoast");
View Full Code Here

  public static void main(String[] args) throws FileNotFoundException,
      InterruptedException {
    Log.setGlobalLogLevel(Log.LogLevel.INFO);

    Params params = new Params();
    JCommander jc = new JCommander(params);
    try {
      jc.parse(args);
    } catch (Exception e) {
      System.out
          .println("Failed to parse parameteres, detailed message below: ");
      System.out.println(e.getMessage());
      System.out.println();
View Full Code Here

    System.out.println(sb.toString());
  }

  public static void main(String[] args) throws SQLException {
    Params params = new Params();
    JCommander jc = new JCommander(params);
    try {
      jc.parse(args);
    } catch (Exception e) {
      System.out
          .println("Failed to parse parameteres, detailed message below: ");
      System.out.println(e.getMessage());
      System.out.println();
View Full Code Here

  }

  public static void main(String[] args) throws IOException,
      IllegalArgumentException, IllegalAccessException {
    params = new Params();
    JCommander jc = new JCommander(params);
    try {
      jc.parse(args);
    } catch (Exception e) {
      System.out
          .println("Failed to parse parameteres, detailed message below: ");
      System.out.println(e.getMessage());
      System.out.println();
View Full Code Here

  }

  public static void main(String[] args) throws IOException,
      IllegalArgumentException, IllegalAccessException {
    Params params = new Params();
    JCommander jc = new JCommander(params);
    try {
      jc.parse(args);
    } catch (Exception e) {
      System.out
          .println("Failed to parse parameteres, detailed message below: ");
      System.out.println(e.getMessage());
      System.out.println();
View Full Code Here

TOP

Related Classes of com.beust.jcommander.JCommander

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.