Package org.apache.commons.cli

Examples of org.apache.commons.cli.BasicParser


        return 0;
    }

    static Arguments parseArguments(String[] args) throws ParseException {
        assert args != null;
        CommandLineParser parser = new BasicParser();
        CommandLine cmd = parser.parse(OPTIONS, args);

        String batchId = cmd.getOptionValue(OPT_BATCH_ID.getOpt());
        LOG.debug("Batch ID: {}", batchId);

        String executionIdPrefix = generateExecutionId();
View Full Code Here


    static Configuration parseConfiguration(String[] args) throws ParseException {
        assert args != null;
        LOG.debug("Analyzing arguments: {}", Arrays.toString(args));

        CommandLineParser parser = new BasicParser();
        CommandLine cmd = parser.parse(OPTIONS, args);

        ClassLoader classLoader = Main.class.getClassLoader();

        YaessLogInput source = create(cmd, OPT_INPUT, YaessLogInput.class, classLoader);
        YaessLogOutput sink = create(cmd, OPT_OUTPUT, YaessLogOutput.class, classLoader);
View Full Code Here

    static Configuration parseConfiguration(String[] args) throws ParseException {
        assert args != null;
        LOG.debug("Analyzing YAESS bootstrap arguments: {}", Arrays.toString(args));

        CommandLineParser parser = new BasicParser();
        CommandLine cmd = parser.parse(OPTIONS, args);

        String profile = cmd.getOptionValue(OPT_PROFILE.getOpt());
        LOG.debug("Profile: {}", profile);
        String script = cmd.getOptionValue(OPT_SCRIPT.getOpt());
        LOG.debug("Script: {}", script);
View Full Code Here

        }
    }

    static Configuration configure(String[] args) throws ParseException {
        assert args != null;
        CommandLineParser parser = new BasicParser();
        CommandLine cmd = parser.parse(OPTIONS, args);
        String output = cmd.getOptionValue(OPT_OUTPUT.getOpt());
        String packageName = cmd.getOptionValue(OPT_PACKAGE.getOpt());
        Charset sourceEnc = parseCharset(cmd.getOptionValue(OPT_SOURCE_ENCODING.getOpt()));
        Charset targetEnc = parseCharset(cmd.getOptionValue(OPT_TARGET_ENCODING.getOpt()));
        String sourcePaths = cmd.getOptionValue(OPT_SOURCE_PATH.getOpt());
View Full Code Here

        assert args != null;
        if (LOG.isDebugEnabled()) {
            LOG.debug("Parsing options: {}", Arrays.toString(args));
        }

        CommandLineParser parser = new BasicParser();
        CommandLine cmd = parser.parse(OPTIONS, args);

        boolean recursive = cmd.hasOption(OPT_RECURSIVE.getOpt());
        String keepString = cmd.getOptionValue(OPT_KEEP_DAYS.getOpt());
        boolean dryRun = cmd.hasOption(OPT_DRY_RUN.getOpt());
        String[] rest = cmd.getArgs();
View Full Code Here

     * @return 復元した設定情報
     * @throws IllegalStateException 復元に失敗した場合
     */
    public static Configuration loadConfigurationFromArguments(String[] args) {
        assert args != null;
        CommandLineParser parser = new BasicParser();
        CommandLine cmd;
        try {
            cmd = parser.parse(OPTIONS, args);
        } catch (ParseException e) {
            throw new IllegalStateException(e);
        }

        Configuration result = new Configuration();
View Full Code Here

  }

  protected CommandLine parseArgs(String[] args) throws ParseException {
    options.addOption(HELP_OPTION, false, "Show usage");
    addOptions();
    CommandLineParser parser = new BasicParser();
    return parser.parse(options, args);
  }
View Full Code Here

    }

    private static ServerConfiguration parseArgs(String[] args)
        throws IllegalArgumentException {
        try {
            BasicParser parser = new BasicParser();
            CommandLine cmdLine = parser.parse(bkOpts, args);

            if (cmdLine.hasOption('h')) {
                throw new IllegalArgumentException();
            }
View Full Code Here

        }
        return options;
    }

    private boolean parseOptions(final Options options, final BootPrinter printer) {
        final CommandLineParser parser = new BasicParser();
        try {
            final CommandLine commandLine = parser.parse(options, args);
            for (final OptionHandler optionHandler : optionHandlers) {
                if (!optionHandler.handle(commandLine, printer, options)) {
                    return false;
                }
            }
View Full Code Here

          .withDescription(description).isRequired(required).create();
      options.addOption(option);
    }

    Parser createParser() {
      return new BasicParser();
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.cli.BasicParser

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.