Package org.kohsuke.args4j

Examples of org.kohsuke.args4j.CmdLineParser.printUsage()


    CmdLineParser parser = new CmdLineParser(params);
    try {
      parser.parseArgument(args);
    } catch (CmdLineException t) {
      System.err.println(t.getMessage());
      parser.printUsage(System.out);
      return;
    }

    // create a lowercase set of excluded repositories
    Set<String> exclusions = new TreeSet<String>();
View Full Code Here


        CmdLineSettings settings = new CmdLineSettings();
        CmdLineParser parser = new CmdLineParser(settings);
        try {
            parser.parseArgument(args);
        } catch (CmdLineException e) {
            parser.printUsage(System.out);
            System.exit(1);
        }
       
        // Load modules
        FloodlightModuleLoader fml = new FloodlightModuleLoader();
View Full Code Here

    CmdLineParser cmdLineParser = new CmdLineParser(flags);
    try {
      cmdLineParser.parseArgument(strings);
    } catch (CmdLineException e) {
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      cmdLineParser.printUsage(stream);
      throw new InvalidFlagException(e.getMessage(), stream.toString());
    }
    if (strings.length == 0 || flags.getDisplayHelp()) {
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      cmdLineParser.printUsage(stream);
View Full Code Here

      cmdLineParser.printUsage(stream);
      throw new InvalidFlagException(e.getMessage(), stream.toString());
    }
    if (strings.length == 0 || flags.getDisplayHelp()) {
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      cmdLineParser.printUsage(stream);
      throw new InvalidFlagException("", stream.toString());
    }
    return flags;
  }
}
View Full Code Here

    logger.info("Arguments: " + argString);
    try {
      parser.parseArgument(args);
      if (commandLineOptions.help) {
        // print the list of available options
        parser.printUsage(System.out);
        System.exit(0);
      }
    } catch (final CmdLineException e) {
      System.err.println(e.getMessage());
      System.exit(-1);
View Full Code Here

        if (args.length == 0 || !ACTIONS.contains(args[0])) {
            for (final String action : ACTIONS) {
                final CmdLineParser parser = new CmdLineParser(Class.forName("fr.inra.lipm.jezlucene.action." + action).newInstance());
                System.out.println(action);
                parser.setUsageWidth(120);
                parser.printUsage(System.out);
            }
            System.exit(2);
        }

        final String[] parameters = Arrays.copyOfRange(args, 1, args.length);
View Full Code Here

        try {
            parser.parseArgument(parameters);
        }
        catch (final CmdLineException e) {
            System.err.println(e.getMessage());
            parser.printUsage(System.out);
            System.exit(2);
        }
    }

    /*
 
View Full Code Here

            int start = e.getMessage().indexOf('"')+1;
            int end   = e.getMessage().lastIndexOf('"');
            String wrongArgument = e.getMessage().substring(start, end);
            System.err.println("Unknown argument: " + wrongArgument);
            System.err.println("ant [options] [target [target2 [target3] ...]]");
            parser.printUsage(System.err);
            System.err.println();
            throw new IOException();
        }
    }
View Full Code Here

            // you'll get this exception. this will report
            // an error message.
            System.err.println(e.getMessage());
            System.err.println("java SampleMain [options...] arguments...");
            // print the list of available options
            parser.printUsage(System.err);
            System.err.println();

            // print option sample. This is useful some time
            System.err.println("  Example: java SampleMain"+parser.printExample(ALL));
View Full Code Here

      logger.log(Level.SEVERE, "Failure", e);
      parseError = true;
    }

    if (options.shouldDisplayHelp() || parseError) {
      parser.printUsage(System.err);
      System.exit(parseError ? 1 : 0);
    }
  }

  private static List<String> processArgs(List<String> args) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.