Package org.apache.commons.cli

Examples of org.apache.commons.cli.Options


    super("log", "l");
  }
 
  protected Options getOptions()
  {
    Options options = new Options();
    options.addOption( new Option("f", "filename", true, "filename to write log to"));
    return options;
  }
View Full Code Here


   
    if (args==null)
      return null;
   
    CommandLineParser parser = new PosixParser();
    Options options = new Options();
    options.addOption("h", "help", false, "Show this help.");
    OptionBuilder.withLongOpt("exec");
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("file");
    OptionBuilder.withDescription("Execute script file. The file should end with 'logout', otherwise the parser thread doesn't stop.");
    options.addOption( OptionBuilder.create('e'));
   
    OptionBuilder.withLongOpt("command");
    OptionBuilder.hasArg();
    OptionBuilder.withArgName("command");
    OptionBuilder.withDescription("Execute single script command. Try '-c help' for help on commands.");
    options.addOption(OptionBuilder.create('c'));
   
    OptionBuilder.withLongOpt("ui");
    OptionBuilder.withDescription("Run <uis>. ',' separated list of user interfaces to run. The first one given will respond to requests without determinable source UI (e.g. further torrents added via command line).");
    OptionBuilder.withArgName("uis");
    OptionBuilder.hasArg();
    options.addOption(OptionBuilder.create('u'));
   
    CommandLine commands = null;
    try {
      commands = parser.parse(options, args, true);
    } catch( ParseException exp ) {
View Full Code Here

*/
public class Stop {

  public static void main(String[] args) {
    // Parse command line options
    Options options = new Options();

    Option helpOption = new Option("h", "help", false, "print this help");
    Option serverURLOption = new Option("s", "serverURL", true,
        "URL of Sesame server to connect to, e.g. http://localhost/openrdf-sesame/ (required)");
    Option keyOption = new Option("k", "shutdownKey", true, "Key to shut down server");

    options.addOption(helpOption);
    options.addOption(serverURLOption);
    options.addOption(keyOption);

    CommandLineParser argsParser = new PosixParser();

    try {
      CommandLine commandLine = argsParser.parse(options, args);
View Full Code Here

  private static final Option keyOption = new Option("k", "shutdownKey", true, "Key to shut down server");

  public static void main(String[] args)
    throws Exception
  {
    Options options = createCliOptions();
    CommandLineParser argsParser = new PosixParser();

    try {
      CommandLine commandLine = argsParser.parse(options, args);
View Full Code Here

      System.exit(1);
    }
  }

  private static Options createCliOptions() {
    Options options = new Options();
    options.addOption(helpOption);
    options.addOption(versionOption);
    options.addOption(dirOption);
    options.addOption(portOption);
    options.addOption(sslPortOption);
    options.addOption(maxAgeOption);
    options.addOption(keyOption);
    return options;
  }
View Full Code Here

    throws Exception
  {
    Console console = new Console();

    // Parse command line options
    Options options = new Options();

    Option helpOption = new Option("h", "help", false, "print this help");
    Option versionOption = new Option("v", "version", false, "print version information");
    Option serverURLOption = new Option("s", "serverURL", true,
        "URL of Sesame server to connect to, e.g. http://localhost/openrdf-sesame/");
    Option dirOption = new Option("d", "dataDir", true, "Sesame data dir to 'connect' to");

    options.addOption(helpOption);
    options.addOption(versionOption);

    OptionGroup connectGroup = new OptionGroup();
    connectGroup.addOption(serverURLOption);
    connectGroup.addOption(dirOption);
    options.addOptionGroup(connectGroup);

    CommandLineParser argsParser = new PosixParser();

    try {
      CommandLine commandLine = argsParser.parse(options, args);
View Full Code Here

    }

    // package-level visibility for testing purposes (just usage/errors at this stage)
    // TODO: should we have an 'err' printstream too for ParseException?
    static void processArgs(String[] args, final PrintStream out) {
        Options options = buildOptions();

        try {
            CommandLine cmd = parseCommandLine(options, args);

            if (cmd.hasOption('h')) {
View Full Code Here

     *
     * @return an options parser.
     */
    @SuppressWarnings("static-access")
    private static synchronized Options buildOptions() {
        Options options = new Options();
        options.addOption(OptionBuilder.hasArg().withArgName("path").withDescription("Specify where to find the class files - must be first argument").create("classpath"));
        options.addOption(OptionBuilder.withLongOpt("classpath").hasArg().withArgName("path").withDescription("Aliases for '-classpath'").create("cp"));

        options.addOption(
            OptionBuilder.withLongOpt("define").
            withDescription("define a system property").
            hasArg(true).
            withArgName("name=value").
            create('D'));
        options.addOption(
            OptionBuilder.withLongOpt("disableopt").
            withDescription("disables one or all optimization elements. " +
                            "optlist can be a comma separated list with the elements: " +
                            "all (disables all optimizations), " +
                            "int (disable any int based optimizations)").
            hasArg(true).
            withArgName("optlist").
            create());
        options.addOption(
            OptionBuilder.hasArg(false)
            .withDescription("usage information")
            .withLongOpt("help")
            .create('h'));
        options.addOption(
            OptionBuilder.hasArg(false)
            .withDescription("debug mode will print out full stack traces")
            .withLongOpt("debug")
            .create('d'));
        options.addOption(
            OptionBuilder.hasArg(false)
            .withDescription("display the Groovy and JVM versions")
            .withLongOpt("version")
            .create('v'));
        options.addOption(
            OptionBuilder.withArgName("charset")
            .hasArg()
            .withDescription("specify the encoding of the files")
            .withLongOpt("encoding")
            .create('c'));
        options.addOption(
            OptionBuilder.withArgName("script")
            .hasArg()
            .withDescription("specify a command line script")
            .create('e'));
        options.addOption(
            OptionBuilder.withArgName("extension")
            .hasOptionalArg()
            .withDescription("modify files in place; create backup if extension is given (e.g. \'.bak\')")
            .create('i'));
        options.addOption(
            OptionBuilder.hasArg(false)
            .withDescription("process files line by line using implicit 'line' variable")
            .create('n'));
        options.addOption(
            OptionBuilder.hasArg(false)
            .withDescription("process files line by line and print result (see also -n)")
            .create('p'));
        options.addOption(
            OptionBuilder.withArgName("port")
            .hasOptionalArg()
            .withDescription("listen on a port and process inbound lines (default: 1960)")
            .create('l'));
        options.addOption(
            OptionBuilder.withArgName("splitPattern")
            .hasOptionalArg()
            .withDescription("split lines using splitPattern (default '\\s') using implicit 'split' variable")
            .withLongOpt("autosplit")
            .create('a'));
View Full Code Here

                        }
                    }
                } else {
                    // hand crank it so we can add our own compiler configuration
                    try {
                        Options options = FileSystemCompiler.createCompilationOptions();

                        PosixParser cliParser = new PosixParser();

                        CommandLine cli;
                        cli = cliParser.parse(options, commandLine);
View Full Code Here

    return transformerFactoryImpl;
  }

  public static void main(String[] args)
  {
    Options options = new Options();

    options.addOption(new Option(LEXICON_OPT, LEXICON_OPT_LONG, true,
                                 "specify lexicon, which should be used"));

    options.addOption(new Option(GRAMMAR_OPT, GRAMMAR_OPT_LONG, true,
                                 "specify grammar, which should be used"));

    options.addOption(new Option(IN_OPT, IN_OPT_LONG, true, "Input file"));

    options.addOption(new Option(OUT_OPT, OUT_OPT_LONG, true, "Output file"));

    CommandLine line = null;
    try
    {
      line = new PosixParser().parse(options, args);
View Full Code Here

TOP

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

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.