Package org.apache.commons.cli

Examples of org.apache.commons.cli.PosixParser


        options.addOption(destination);
        options.addOption(debug);
    }

    public void run() throws ParseException, IOException, UtilityException {
        CommandLineParser parser = new PosixParser();
        CommandLine line = parser.parse(options, args);

        String[] args = line.getArgs();
        if(args.length != 1) {
            abort();
            return;
View Full Code Here


   */
  public static boolean parseHelpArgument(String[] args,
      String helpDescription, PrintStream out, boolean printGenericCommandUsage) {
    if (args.length == 1) {
      try {
        CommandLineParser parser = new PosixParser();
        CommandLine cmdLine = parser.parse(helpOptions, args);
        if (cmdLine.hasOption(helpOpt.getOpt())
            || cmdLine.hasOption(helpOpt.getLongOpt())) {
          // should print out the help information
          out.println(helpDescription + "\n");
          if (printGenericCommandUsage) {
View Full Code Here

    public boolean shouldPrintHelp() {
      return shouldPrintHelp;
    }
   
    public void parse(String ... argv) throws ParseException {
      CommandLineParser parser = new PosixParser();
      CommandLine cmdLine = parser.parse(options, argv);
     
      if (cmdLine.hasOption(helpOpt.getOpt())
          || cmdLine.hasOption(helpOpt.getLongOpt())) {
        shouldPrintHelp = true;
        return;
View Full Code Here

        logger.addAppender(consoleAppender);

        logger.setLevel(Level.ERROR);

        Options options = generateOptions();
        CommandLineParser parser = new PosixParser();

        try {
            CommandLine line = parser.parse(options, args);

            ip = line.getOptionValue(CMD_IP);
            sender = line.getOptionValue(CMD_SENDER);
            helo = line.getOptionValue(CMD_HELO);
            defaultExplanation = line.getOptionValue(CMD_DEFAULT_EXP);
View Full Code Here

     * @param args arguments passed on the command line
     * @throws ParseException for missing required, or unrecognized options
     */
    private void parseArgs(String[] args) throws ParseException
    {
        CommandLineParser parser = new PosixParser();
        cmd = parser.parse(options, args);
    }
View Full Code Here

    public static void main(String[] args) throws Exception {
       
        Options options = new Options();
        options.addOption("domain", true, "the url of the remote domain this node should connect to");
        CommandLineParser parser = new PosixParser();
        CommandLine cmd = parser.parse( options, args);
        if (cmd.getArgs().length != 1) {
            System.err.println("missing contributions folder parameter");
            System.exit(1);
        }
        File f = new File(cmd.getArgs()[0]);
View Full Code Here

      if (args.length == 0) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("HFile ", options, true);
        System.exit(-1);
      }
      CommandLineParser parser = new PosixParser();
      CommandLine cmd = parser.parse(options, args);
      boolean verbose = cmd.hasOption("v");
      boolean printKeyValue = cmd.hasOption("p");
      boolean printMeta = cmd.hasOption("m");
      boolean checkRow = cmd.hasOption("k");
      boolean checkFamily = cmd.hasOption("a");
View Full Code Here

    if (args == null || args.length == 0) {
      HelpFormatter helpFormatter = new HelpFormatter();
      helpFormatter.printHelp("java " + ZKDumper.class.getName(), options);
      System.exit(1);
    }
    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);
    cmd.hasOption("zkSvr");
    boolean download = cmd.hasOption("download");
    boolean upload = cmd.hasOption("upload");
    boolean del = cmd.hasOption("delete");
    String zkAddress = cmd.getOptionValue("zkSvr");
View Full Code Here

     * @param args arguments passed on the command line
     * @throws ParseException for missing required, or unrecognized options
     */
    private void parseArgs(String[] args) throws ParseException
    {
        CommandLineParser parser = new PosixParser();
        cmd = parser.parse(options, args);
    }
View Full Code Here

   */
  AbstractCliRobotAgent(String waveDomain, TokenGenerator tokenGenerator,
      ServerFrontendAddressHolder frontendAddressHolder, AccountStore accountStore,
      RobotRegistrar robotRegistrar, Boolean sslEnabled) {
    super(waveDomain, tokenGenerator, frontendAddressHolder, accountStore, robotRegistrar, sslEnabled);
    parser = new PosixParser();
    helpFormatter = new HelpFormatter();
    options = initOptions();
  }
View Full Code Here

TOP

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

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.