Package org.kohsuke.args4j

Examples of org.kohsuke.args4j.CmdLineParser


    private void usage() {
        System.err.println(Messages.USAGE);
    }

    private int doMain(String[] args) {
        CmdLineParser parser = new CmdLineParser(this);

        try {
            parser.parseArgument(args);
        } catch (CmdLineException e) {
            System.err.println(e.getMessage());
            usage();
            return -1;
        }
View Full Code Here


     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        Date start = new Date();
        final CmdLineOptions opts = new CmdLineOptions();
        CmdLineParser parser = new CmdLineParser(opts);

        // parse command line options, give error message if no arguments passed
        try {
            parser.parseArgument(args);
        } catch (Exception e) {
            parser.printUsage(System.err);
            return;
        }
        if (opts.arguments.isEmpty()) {
            parser.printUsage(System.err);
            return;
        }
        VXQuery vxq = new VXQuery(opts);
        vxq.execute();
        // if -timing argument passed, show the starting and ending times
View Full Code Here

        final MockServerBootstrap bootstrap = new MockServerBootstrap();
        System.exit(bootstrap.runApplication(args));
    }

    private int runApplication(String[] args) {
        CmdLineParser cmdLineParser = new CmdLineParser(this);
        try {
            cmdLineParser.parseArgument(args);

        } catch (CmdLineException e) {
            // if there's a problem in the command line,
            // you'll get this exception. this will report
            // an error message.
            System.err.println(e.getMessage());
            System.err.println("./mockserver [options...]");

            // print the list of available options
            cmdLineParser.printUsage(System.err);
            System.err.println();

            // print option sample. This is useful some time
            System.err.println("  Example: ./mockserver"
                    + cmdLineParser.printExample(ExampleMode.ALL));

            return -1;
        }

        // infer format from filename
View Full Code Here

   * @throws Exception
   */
  public static void main(CloudAdapter cloudAdapter, String[] args)
      throws Exception {
    CloudAdapterOptions arguments = new CloudAdapterOptions();
    CmdLineParser parser = new CmdLineParser(arguments);
    parser.setUsageWidth(80);

    try {
      parser.parseArgument(args);
    } catch (CmdLineException e) {
      log.error("error: " + e.getMessage());
      parser.printUsage(System.err);
      System.exit(-1);
    }

    if (arguments.help) {
      parser.printUsage(System.err);
      System.exit(0);
    }

    Server server = createServer(cloudAdapter, arguments);

View Full Code Here

*/
public class FederationClient {

  public static void main(String[] args) {
    Params params = new Params();
    CmdLineParser parser = new CmdLineParser(params);
    try {
      parser.parseArgument(args);
    } catch (CmdLineException t) {
      usage(parser, t);
    }

    System.out.println("Gitblit Federation Client v" + Constants.getVersion() + " (" + Constants.getBuildDate() + ")");
View Full Code Here

      }
    }

    Params.baseFolder = folder;
    Params params = new Params();
    CmdLineParser parser = new CmdLineParser(params);
    try {
      parser.parseArgument(filtered);
      if (params.help) {
        reindex.usage(parser, null);
        return;
      }
    } catch (CmdLineException t) {
View Full Code Here

      }
    }

    Params.baseFolder = folder;
    Params params = new Params();
    CmdLineParser parser = new CmdLineParser(params);
    try {
      parser.parseArgument(filtered);
      if (params.help) {
        server.usage(parser, null);
      }
    } catch (CmdLineException t) {
      server.usage(parser, t);
View Full Code Here

  }

  public JoocConfiguration parse(String[] args) throws CommandLineParseException {
    JoocConfiguration config = new JoocConfiguration();

    CmdLineParser parser = new CmdLineParser(config);
    try {
      // parse the arguments.
      parser.parseArgument(args);
    } catch (CmdLineException e) {
      StringBuilder msg = extendedUsage(parser, e);
      throw new CommandLineParseException(msg.toString(), -1);
    }
    return parseConfig(parser, config);
View Full Code Here

  public static int run(String[] args){

    FileLocations config = new FileLocations();

    CmdLineParser parser = new CmdLineParser(config);
    try {
      // parse the arguments.
      parser.parseArgument(args);
    } catch (CmdLineException e) {
      StringBuilder msg = new StringBuilder();
      // if there's a problem in the command line,
      // you'll get this exception. this will report
      // an error message.
      msg.append(e.getMessage());
      msg.append("\n");
      msg.append("java -jar properties-compiler.jar [options...] source files...\n");
      // print the list of available options
      StringWriter writer = new StringWriter();
      parser.printUsage(writer, null);
      msg.append(writer.getBuffer());
      msg.append("\n");
      // print option sample. This is useful some time
      msg.append("  Example: java -jar properties-compiler.jar").append(parser.printExample(REQUIRED));
      msg.append("\n");
      System.err.println(msg); // NOSONAR this is a commandline tool
      return -1;
    }
View Full Code Here

  }

  public ExmlConfiguration parse(String[] args) throws CommandLineParseException {
    ExmlConfiguration config = new ExmlConfiguration();

    CmdLineParser parser = new CmdLineParser(config);
    try {
      // parse the arguments.
      parser.parseArgument(args);
    } catch (CmdLineException e) {
      StringBuilder msg = extendedUsage(parser, e);
      throw new CommandLineParseException(msg.toString(), -1);
    }
    return parseConfig(parser, config);
View Full Code Here

TOP

Related Classes of org.kohsuke.args4j.CmdLineParser

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.