Package org.apache.commons.cli

Examples of org.apache.commons.cli.BasicParser


      options.addOption(option);

    }

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


     *        the arguments
     */
    private void run(String[] args) {
        try {
            // parse arguments
            Parser parser = new BasicParser();
            org.apache.commons.cli.CommandLine cl = parser.parse(options, args);

            // Set locale
            this.setLocale(cl);

            // Welcome message
View Full Code Here

      .build();

  private final CommandLine cl;

  public PstCommandLine(String... args) throws ParseException {
    cl = new BasicParser().parse(getOptions(), args);
    checkArgs();
  }
View Full Code Here

  // Not for client use
  public boolean config(String... args) {
   
    CommandLine cl;
    try {
      cl = new BasicParser().parse(opts, args);
      if (cl.getArgs().length > 0)
        throw new ParseException("Unrecognized arguments: " + cl.getArgList());
     
      if (cl.hasOption(helpOpt.getOpt())) {
        configError = true;
View Full Code Here

       
        // Get the options from the command on how to parse the string
        Options parseOpts = sc.getOptionsWithHelp();
       
        // Parse the string using the given options
        CommandLine cl = new BasicParser().parse(parseOpts, fields);
       
        int actualArgLen = cl.getArgs().length;
        int expectedArgLen = sc.numArgs();
        if (cl.hasOption(helpOption)) {
          // Display help if asked to; otherwise execute the command
View Full Code Here

        // Parse command line arguments.
        CommandLine command = null;
        String message = null;
        try {
            BasicParser parser = new BasicParser();
            command = parser.parse(options, arguments);
            if (command.getArgs().length > 0) {
                message = String.format(messages.getString(
                    "Invalid_argument__%s"), command.getArgs()[0]);
            }
        } catch (UnrecognizedOptionException exception) {
View Full Code Here

        final Options options = new Options();
        options.addOption("h", "help", false, "Show this help");
        options.addOption("m", "mode", true, "mode: normal | secondary | recovery | archive");

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

        if (cmd.hasOption('h')) {
            printHelp(options);
            return;
        }
View Full Code Here

  }
 
  /** parse command line arguments */
  private void parse(String[] args) {
    Options cliOpts = setupOptions();
    BasicParser parser = new BasicParser();
    CommandLine cl = null;
    try {
      try {
       cl = parser.parse(cliOpts, args);
      } catch (ParseException ex) {
        throw new IllegalArgumentException("args = " + Arrays.toString(args));
      }

      int newThreshold = Integer.parseInt(cl.getOptionValue("threshold", "10"));
View Full Code Here

        options.addOption( "f", "forceOverwriteOutputVfsRepository", false, "Force overwriting the Guvnor 6 VFS repository" );

        CommandLine commandLine;
        HelpFormatter formatter = new HelpFormatter();
        try {
            commandLine = new BasicParser().parse( options, args );
        } catch ( ParseException e ) {
            formatter.printHelp( formatstr, options );
            return false;
        }
View Full Code Here

    opts.addOptionGroup(authTimeoutOptions);

    CommandLine cl;
    try {
      cl = new BasicParser().parse(opts, args);
      if (cl.getArgs().length > 0)
        throw new ParseException("Unrecognized arguments: " + cl.getArgList());

      if (cl.hasOption(helpOpt.getOpt())) {
        configError = true;
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.