Example usage for org.apache.commons.cli OptionBuilder withLongOpt

List of usage examples for org.apache.commons.cli OptionBuilder withLongOpt

Introduction

In this page you can find the example usage for org.apache.commons.cli OptionBuilder withLongOpt.

Prototype

public static OptionBuilder withLongOpt(String newLongopt) 

Source Link

Document

The next Option created will have the following long option value.

Usage

From source file:org.application.backupsync.client.Main.java

public Main() {
    this.opts = new Options();

    this.opts.addOption("h", "help", false, "Print this help");
    this.opts.addOption(OptionBuilder.withLongOpt("port").withDescription("Set port number").hasArg()
            .withArgName("PORT").create("p"));
}

From source file:org.application.backupsync.server.Main.java

public Main() {
    this.opts = new Options();

    this.opts.addOption("h", "help", false, "Print this help");
    this.opts.addOption(OptionBuilder.withLongOpt("cfg").withDescription("Use the specified configuration file")
            .hasArg().withArgName("CFGFILE").create("c"));
    this.opts.addOption("H", false, "Hourly backup is executed");
    this.opts.addOption("D", false, "Daily backup is executed");
    this.opts.addOption("W", false, "Weekly backup is executed");
    this.opts.addOption("M", false, "Monthly backup is executed");

}

From source file:org.asqatasun.runner.Asqatasun.java

/**
 * Create the asqatasun command line interface options
 * @return the options to launch asqatasun cli
 *///  w w  w .j a va2  s  .c  o  m
private static Options createOptions() {
    Options options = new Options();

    options.addOption(OptionBuilder.withLongOpt("help").withDescription("Show this message.").hasArg(false)
            .isRequired(false).create("h"));

    options.addOption(OptionBuilder.withLongOpt("output").withDescription("Path to the output result file.")
            .hasArg().isRequired(false).create("o"));

    options.addOption(OptionBuilder.withLongOpt("firefox-bin").withDescription("Path to the firefox bin.")
            .hasArg().isRequired(false).create("f"));

    options.addOption(OptionBuilder.withLongOpt("display").withDescription("Value of the display").hasArg()
            .isRequired(false).create("d"));

    options.addOption(OptionBuilder.withLongOpt("referential")
            .withDescription("Referential : \n" + "- \"Aw22\" for Accessiweb 2.2 (default)\n"
                    + "- \"Rgaa22\" for Rgaa 2.2\n" + "- \"Rgaa30\" for Rgaa 3.0\n")
            .hasArg().isRequired(false).create("r"));

    options.addOption(OptionBuilder.withLongOpt("level")
            .withDescription("Level :\n" + "- \"Or\" for Gold level or AAA level, \n"
                    + "- \"Ar\" for Silver level or AA level (default), \n"
                    + "- \"Bz\" for Bronze level or A level")
            .hasArg().isRequired(false).create("l"));

    options.addOption(
            OptionBuilder.withLongOpt("audit-type")
                    .withDescription("Audit type :\n" + "- \"Page\" for page audit (default)\n"
                            + "- \"File\" for file audit \n" + "- \"Scenario\" for scenario audit \n"
                            + "- \"Site\" for site audit")
                    .hasArg().isRequired(false).create("t"));
    options.addOption(OptionBuilder
            .withLongOpt("xmx-value").withDescription("Xmx value set to the process (without 'M' at the end):\n"
                    + "- default is 256 \n" + "- must be superior to 64 (Xms value)")
            .hasArg().isRequired(false).create("x"));

    return options;
}

From source file:org.bazu.jotex.CommandLineLauncher.java

public static Options getOptionsInstance() {
    PosixParser parser = new PosixParser();

    // create the Options
    Options options = new Options();
    options.addOption("h", "help", false, "Print Jotex comman line help");
    options.addOption("d", false, "Enable debug mode");
    options.addOption("b", false,
            "Expose bookmarks (if presents) in alphabetical order,  at the end of the TOC");
    // options.addOption( "A", "almost-all", false, "do not list implied . and .." );
    // options.addOption( "b", "escape", false, "print octal escapes for nongraphic "
    //                                         + "characters" );
    options.addOption(/*  w w w  .j  av  a 2s .c  om*/
            OptionBuilder.withLongOpt("max-file-size").withDescription("Max single xhtml's file size in KB")
                    .hasArg().withArgName("SIZE").withType(Integer.class).create("s"));

    options.addOption(OptionBuilder.withLongOpt("fem")
            .withDescription(
                    "Fonts Encriptyon Method. Used if, for licensing reasons, fonts need to be encrypted.\r\n")
            .hasArg().withArgName("adobe|idpf").withType(Integer.class).create("e"));

    options.addOption(OptionBuilder.withLongOpt("fp").withDescription(
            "Fonts Path. A path in which Jotex looks for Fonts files that need to be embedded (in an encrypted form [see \"fem\" option]) into the epub.\r\n"
                    + "Without this param NO FONT will be included into the epub")
            .hasArg().withArgName("FONTS_PATH")
            //.withType(Integer.class)
            .create("f"));

    options.addOption(OptionBuilder.withLongOpt("output").withDescription(
            "Output file. If not present, Jotex will create an epub file in the same original odt's directory  with the same original odt's file name")
            .hasArg().withArgName("OUTPUT_FILE").create("o"));

    options.addOption(OptionBuilder.withLongOpt("cover")
            .withDescription(
                    "Full path to the epub cover (gif or jpg or png). If not present no cover will be used")
            .hasArg().withArgName("COVER_IMG_FILE").create("c"));
    //    options.addOption( "B", "ignore-backups", false, "do not list implied entried "
    //                                                  + "ending with ~");
    //    options.addOption( "c", false, "with -lt: sort by, and show, ctime (time of last " 
    //                                + "modification of file status information) with "
    //                                + "-l:show ctime and sort by name otherwise: sort "
    //                                + "by ctime" );
    //    options.addOption( "C", false, "list entries by columns" );
    return options;
}

From source file:org.cc.smali.main.java

@SuppressWarnings("AccessStaticViaInstance")
private static void buildOptions() {
    Option versionOption = OptionBuilder.withLongOpt("version").withDescription("prints the version then exits")
            .create("v");

    Option helpOption = OptionBuilder.withLongOpt("help")
            .withDescription("prints the help message then exits. Specify twice for debug options").create("?");

    Option outputOption = OptionBuilder.withLongOpt("output")
            .withDescription("the name of the dex file that will be written. The default is out.dex").hasArg()
            .withArgName("FILE").create("o");

    Option allowOdexOption = OptionBuilder.withLongOpt("allow-odex-instructions")
            .withDescription("allow odex instructions to be compiled into the dex file. Only a few"
                    + " instructions are supported - the ones that can exist in a dead code path and not"
                    + " cause dalvik to reject the class")
            .create("x");

    Option apiLevelOption = OptionBuilder.withLongOpt("api-level")
            .withDescription("The numeric api-level of the file to generate, e.g. 14 for ICS. If not "
                    + "specified, it defaults to 15 (ICS).")
            .hasArg().withArgName("API_LEVEL").create("a");

    Option experimentalOption = OptionBuilder.withLongOpt("experimental")
            .withDescription("enable experimental opcodes to be assembled, even if they "
                    + " aren't necessarily supported by the Android runtime yet")
            .create("X");

    Option jobsOption = OptionBuilder.withLongOpt("jobs")
            .withDescription("The number of threads to use. Defaults to the number of cores available, up to a "
                    + "maximum of 6")
            .hasArg().withArgName("NUM_THREADS").create("j");

    Option verboseErrorsOption = OptionBuilder.withLongOpt("verbose-errors")
            .withDescription("Generate verbose error messages").create("V");

    Option printTokensOption = OptionBuilder.withLongOpt("print-tokens")
            .withDescription("Print the name and text of each token").create("T");

    basicOptions.addOption(versionOption);
    basicOptions.addOption(helpOption);/*from  w w w . j a  va 2 s. c  o  m*/
    basicOptions.addOption(outputOption);
    basicOptions.addOption(allowOdexOption);
    basicOptions.addOption(apiLevelOption);
    basicOptions.addOption(experimentalOption);
    basicOptions.addOption(jobsOption);

    debugOptions.addOption(verboseErrorsOption);
    debugOptions.addOption(printTokensOption);

    for (Object option : basicOptions.getOptions()) {
        options.addOption((Option) option);
    }

    for (Object option : debugOptions.getOptions()) {
        options.addOption((Option) option);
    }
}

From source file:org.cc86.MMC.client.Main.java

public static void main(String[] args) {
    //args=new String[]{"--demo"};
    CommandLineParser parser = new DefaultParser();
    Options options = new Options();
    options.addOption("d", "demo", false, "Demo UI modus fr die H+E in Schuttgart");
    options.addOption("x", "devmode", false, "Allows the Demo mode to be closed");
    options.addOption(/*from   ww w.ja v  a  2  s . c om*/
            OptionBuilder.withLongOpt("ip").withDescription("ip").hasArg().withArgName("ADDR").create("i"));
    try {
        String srvr = "0.0.0.0";
        TimeoutManager m = null;
        CommandLine cl = parser.parse(options, args);
        setupLogging(true);
        if (cl.hasOption("i")) {
            srvr = cl.getOptionValue("i");
        } else {
            serverDiscoveryHack(args);
            return;
            //Main.setupLogging(cl.hasOption("verbose"));

            //m = new TimeoutManager(2, ()->Messagers.SingleLineMsg("Serversuche fehlgeschlagen", "OK"));
            //m.start();
            //srvr =serverDiscovery();//;//"10.110.12.183";//
            //srvr="192.168.10.41";
        }
        l.info(srvr);
        if (srvr.equals("0.0.0.0")) {
            l.error("NO SERVER FOUND");
            System.exit(0);

        }
        c = new TCPConnection(srvr, 0xCC86);
        try {
            c.connect();
        } catch (IOException ex) {
            //System.out.println(ex.m);
            l.trace("Ell-Emm-AhhX2");
            l.error("FAILED TO CONNECT");
            System.exit(0);
        }
        piIP = srvr;
        disp.connect(c);
        Runtime.getRuntime().addShutdownHook(new Thread(disp::quit));
        if (m != null) {
            m.disarm();
        }

        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
        * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
        */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager
                    .getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TestsUI.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TestsUI.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TestsUI.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TestsUI.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        }
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                | UnsupportedLookAndFeelException e) {
            l.error("Fehler beim Setzen des LookAndFeels");
        }
        devmode = cl.hasOption("devmode");
        if (cl.hasOption("demo")) {
            java.awt.EventQueue.invokeLater(() -> {
                //ui = new TestsUI();
                //ui.setVisible(true);
                DemoUI.bootUI();
            });
        }

        else {
            java.awt.EventQueue.invokeLater(() -> {
                //ui = new TestsUI();
                //ui.setVisible(true);
                Menu.bootUI();
            });
        }
    } catch (ParseException ex) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("client", options);
        // ex.printStackTrace();
    }

}

From source file:org.codehaus.groovy.tools.FileSystemCompiler.java

@SuppressWarnings({ "AccessStaticViaInstance" })
public static Options createCompilationOptions() {
    ///* w  w w  .java2  s .c  om*/
    // Parse the command line

    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("sourcepath").hasArg().withArgName("path")
            .withDescription("Specify where to find the source files").create());
    options.addOption(OptionBuilder.withLongOpt("temp").hasArg().withArgName("temp")
            .withDescription("Specify temporary directory").create());
    options.addOption(OptionBuilder.withLongOpt("encoding").hasArg().withArgName("encoding")
            .withDescription("Specify the encoding of the user class files").create());
    options.addOption(
            OptionBuilder.hasArg().withDescription("Specify where to place generated class files").create('d'));
    //            options.addOption(OptionBuilder.withLongOpt("strict").withDescription("Turn on strict type safety.").create('s'));
    options.addOption(OptionBuilder.withLongOpt("help").withDescription("Print a synopsis of standard options")
            .create('h'));
    options.addOption(OptionBuilder.withLongOpt("version").withDescription("Print the version").create('v'));
    options.addOption(
            OptionBuilder.withLongOpt("exception").withDescription("Print stack trace on error").create('e'));
    options.addOption(OptionBuilder.withLongOpt("jointCompilation")
            .withDescription("Attach javac compiler to compile .java files").create('j'));
    options.addOption(OptionBuilder.withLongOpt("basescript").hasArg().withArgName("class")
            .withDescription("Base class name for scripts (must derive from Script)").create('b'));

    options.addOption(OptionBuilder.withArgName("property=value").withValueSeparator().hasArgs(2)
            .withDescription("name-value pairs to pass to javac").create("J"));
    options.addOption(OptionBuilder.withArgName("flag").hasArg()
            .withDescription("passed to javac for joint compilation").create("F"));

    options.addOption(OptionBuilder.withLongOpt("indy")
            .withDescription("enables compilation using invokedynamic").create());
    options.addOption(OptionBuilder.withLongOpt("configscript").hasArg()
            .withDescription("A script for tweaking the configuration options").create());
    return options;
}

From source file:org.codehaus.plexus.tools.cli.AbstractCli.java

public Options buildDefaultCliOptions() {
    options = new Options();

    options.addOption(OptionBuilder.withLongOpt("define").hasArg().withDescription("Define a system property")
            .create(SET_SYSTEM_PROPERTY));
    options.addOption(/* ww  w . j a  va 2s .c  o m*/
            OptionBuilder.withLongOpt("help").withDescription("Display help information").create(HELP));
    options.addOption(OptionBuilder.withLongOpt("version").withDescription("Display version information")
            .create(VERSION));
    options.addOption(OptionBuilder.withLongOpt("quiet").withDescription("Quiet output - only show errors")
            .create(QUIET));
    options.addOption(
            OptionBuilder.withLongOpt("debug").withDescription("Produce execution debug output").create(DEBUG));
    options.addOption(OptionBuilder.withLongOpt("errors").withDescription("Produce execution error messages")
            .create(ERRORS));

    return buildCliOptions(options);
}

From source file:org.codehaus.plexus.tools.cli.TestCli.java

public Options buildCliOptions(Options options) {
    options.addOption(OptionBuilder.withLongOpt("name").withDescription("Display name.").hasArg().create('n'));

    return options;
}

From source file:org.commonjava.emb.boot.main.EMBCLIManager.java

@SuppressWarnings("static-access")
public EMBCLIManager() {
    options = new Options();

    options.addOption(OptionBuilder.withLongOpt("debug-emb").hasArg()
            .withDescription("Comma-separated list of EMB log-handles to debug.")
            .create(XAVEN_DEBUG_LOG_HANDLES));

    populateNativeMavenOptions(options);
}