Package org.apache.commons.cli

Examples of org.apache.commons.cli.BasicParser


        for (int i = 0; i < opts.length; i++)
        {
            options.addOption(opts[i][0], opts[i][1].equals("true") ? true : false, opts[i][2]);
        }

        BasicParser parser = new BasicParser();

        try
        {
            CommandLine line = parser.parse(options, args, true);
            if (line == null)
            {
                throw new DefaultMuleException("Unknown error parsing the Mule command line");
            }
View Full Code Here


        Options options = new Options();
        for (int i = 0; i < CLI_OPTIONS.length; i++)
        {
            options.addOption(CLI_OPTIONS[i][0], "true".equalsIgnoreCase(CLI_OPTIONS[i][1]), CLI_OPTIONS[i][2]);
        }
        return new BasicParser().parse(options, args, true);
    }
View Full Code Here

        Options options = new Options();
        for (int i = 0; i < CLI_OPTIONS.length; i++)
        {
            options.addOption(CLI_OPTIONS[i][0], "true".equalsIgnoreCase(CLI_OPTIONS[i][1]), CLI_OPTIONS[i][2]);
        }
        return new BasicParser().parse(options, args, true);
    }
View Full Code Here

    opts.addOption(optOffline);
    opts.addOption(optAddress);
   
    try {
      fs = FileSystem.get(CachedConfiguration.getInstance());
      commandLine = new BasicParser().parse(opts, args);
      if (commandLine.getArgs().length != 0)
        throw new ParseException("Extraneous arguments");
     
      safemode = commandLine.hasOption(optSafeMode.getOpt());
      offline = commandLine.hasOption(optOffline.getOpt());
View Full Code Here

   
    Options opts = new Options();
    Option dumpKeys = new Option("d", "dump", false, "dump the key/value pairs");
    opts.addOption(dumpKeys);
   
    CommandLine commandLine = new BasicParser().parse(opts, args);
   
    for (String arg : commandLine.getArgs()) {
     
      Path path = new Path(arg);
      CachableBlockFile.Reader _rdr = new CachableBlockFile.Reader(fs, path, conf, null, null);
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

       
        // 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

      OPTIONS.addOption(opt);
    }
  }
 
  public static void main(String[] args) throws Exception {
    CommandLine commandLine = new BasicParser().parse(OPTIONS, args);
    int code = 0;
    if (code == 0 && commandLine.hasOption(LIST_SPANS.getLongOpt())) {
      code = listSpans(commandLine);
    }
    if (code == 0 && commandLine.hasOption(DUMP_TRACE.getLongOpt())) {
View Full Code Here

    Options opts = new Options();
   
    opts.addOption(usernameOpt);
    opts.addOption(passwordOpt);
   
    Parser p = new BasicParser();
    CommandLine cl = null;
    try {
      cl = p.parse(opts, args);
    } catch (ParseException e1) {
      System.out.println("Parse Exception, exiting.");
      return;
    }
   
View Full Code Here

   
    Options opts = new Options();
    Option maxSizeOption = new Option("m", "", true, "the maximum size of the key/value pair to shunt to the small file");
    opts.addOption(maxSizeOption);
   
    CommandLine commandLine = new BasicParser().parse(opts, args);
    if (commandLine.hasOption(maxSizeOption.getOpt())) {
      maxSize = Long.parseLong(commandLine.getOptionValue(maxSizeOption.getOpt()));
    }
   
    for (String arg : commandLine.getArgs()) {
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.