Package org.apache.commons.cli2.builder

Examples of org.apache.commons.cli2.builder.CommandBuilder


    private Option optCreds;
    private Option optForce;
    private Argument argWorkspace;

    protected Command createCommand() {
        return new CommandBuilder()
                .withName("login")
                .withDescription(getShortDescription())
                .withChildren(new GroupBuilder()
                        .withName("Options:")
                        .withOption(optCreds = new DefaultOptionBuilder()
View Full Code Here


    public String getShortDescription() {
        return "Connect to a repository";
    }

    protected Command createCommand() {
        return new CommandBuilder()
                .withName("connect")
                .withDescription(getShortDescription())
                .withChildren(new GroupBuilder()
                        .withName("Options:")
                        .withOption(optForce = new DefaultOptionBuilder()
View Full Code Here

        fmtFlag |= cl.hasOption(optType) ? F_FLAG_TYPE : 0;
        return fmtFlag;
    }

    protected Command createCommand() {
        return new CommandBuilder()
                .withName("ls")
                .withDescription(getShortDescription())
                .withChildren(new GroupBuilder()
                        .withName("Options:")
                        .withOption(optType = new DefaultOptionBuilder()
View Full Code Here

    public String getShortDescription() {
        return "Unmount the Vault filesystem";
    }

    protected Command createCommand() {
        return new CommandBuilder()
                .withName("unmount")
                .withDescription(getShortDescription())
                .create();
    }
View Full Code Here

    private Option optRecursive;
    private Argument argPath;

    protected Command createCommand() {
        return new CommandBuilder()
                .withName("tree")
                .withDescription(getShortDescription())
                .withChildren(new GroupBuilder()
                        .withName("Options:")
                        .withOption(optRecursive = new DefaultOptionBuilder()
View Full Code Here

        fmtFlag |= cl.hasOption(optLong) ? F_FLAG_LONG : 0;
        return fmtFlag;
    }

    protected Command createCommand() {
        return new CommandBuilder()
                .withName("ls")
                .withDescription(getShortDescription())
                .withChildren(new GroupBuilder()
                        .withName("Options:")
                        .withOption(optTime = new DefaultOptionBuilder()
View Full Code Here

    public String getShortDescription() {
        return "Print the value of a property on files or directories.";
    }

    protected Command createCommand() {
        return new CommandBuilder()
                .withName("propget")
                .withName("pg")
                .withDescription(getShortDescription())
                .withChildren(new GroupBuilder()
                        .withName("Options:")
View Full Code Here

    private Option optUpdate;
    private Option optNewer;
    private Option optNoOrdering;

    protected Command createCommand() {
        return new CommandBuilder()
                .withName("rcp")
                .withDescription(getShortDescription())
                .withChildren(new GroupBuilder()
                        .withName("Options:")
                        .withOption(OPT_QUIET)
View Full Code Here

  {
    Parser parser = new Parser();

    // configure a HelpFormatter
    HelpFormatter hf = new HelpFormatter();
    DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();
    ;

    // configure a parser
    Parser p = new Parser();
    p.setGroup(group);
    p.setHelpFormatter(hf);
    p.setHelpOption(oBuilder.withLongName("help").withShortName("?").create());
    cl = p.parseAndHelp(args);

    // abort application if no CommandLine was parsed
    if (cl == null)
    {
View Full Code Here

  /**
   * Builds the options.
   */
  private static void buildOptions()
  {
    DefaultOptionBuilder oBuilder = new DefaultOptionBuilder("-", "--", true);
    ArgumentBuilder aBuilder = new ArgumentBuilder();
    GroupBuilder gBuilder = new GroupBuilder();

    gBuilder.withOption(oBuilder.reset().withId(OPTION_C).withShortName("c").withLongName("console").withDescription(
        "run as a Console application").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_T).withShortName("t").withLongName("start").withDescription(
        "starT an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_P).withShortName("p").withLongName("stop").withDescription(
        "stoP a running NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_TX).withShortName("tx").withLongName("startx").withDescription(
        "starT -internal a Posix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_PX).withShortName("px").withLongName("stopx").withDescription(
        "stoP -internal- a running Posix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_I).withShortName("i").withLongName("install").withDescription(
        "Install an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_R).withShortName("r").withLongName("remove").withDescription(
        "Remove an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_Q).withShortName("q").withLongName("query").withDescription(
        "Query the status of an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_Y).withShortName("y").withLongName("tray").withDescription("Start System Tray Icon")
        .create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_QS).withShortName("qs").withLongName("querysilent").withDescription(
        "Silent Query the status of an NT service or Unix daemon").create());
    gBuilder.withOption(oBuilder.reset().withId(OPTION_QX).withShortName("qx").withLongName("queryposix").withDescription(
        "Query the status of a posix daemon. Return status as exit code").create());

    Argument pid = aBuilder.reset().withName(PID).withDescription("PID of process to reconnect to").withMinimum(1).withMaximum(1).withValidator(
        NumberValidator.getIntegerInstance()).create();

    gBuilder.withOption(oBuilder.reset().withId(OPTION_N).withShortName("n").withLongName("reconnect").withDescription(
        "recoNnect to existing application").withArgument(pid).create());

    Argument pid2 = aBuilder.reset().withName(PID).withDescription("PID of process to reconnect to").withMinimum(1).withMaximum(1).withValidator(
        NumberValidator.getIntegerInstance()).create();

    Argument defaultFile = aBuilder.reset().withName(DEFAULT_FILE).withDescription("Default Configuration File").withMinimum(0).withMaximum(1)
        .withValidator(VFSFileValidator.getExistingFileInstance().setBase(".")).create();
    /*
     * GroupBuilder childGbuilder = new GroupBuilder(); DefaultOptionBuilder
     * childoObuilder = new DefaultOptionBuilder("-", "--", true);
     *
     * childGbuilder.withName(DEFAULT_FILE).withMinimum(0).withMaximum(1).
     * withOption(
     * childoObuilder.withId(OPTION_D).withArgument(defaultFile).
     * withShortName("d").withLongName("defaultConf").withDescription(
     * "Default Configuration File").create());
     *
     *
     *
     * gBuilder.withOption(oBuilder.reset().withId(OPTION_G).withShortName("g"
     * ).withLongName("genconf").withDescription(
     * "Generate configuration file from pid"
     * ).withArgument(pid2).withChildren(childGbuilder.create()).create());
     */

    gBuilder.withOption(oBuilder.reset().withId(OPTION_D).withShortName("d").withLongName("defaultConf").withDescription(
        "Default Configuration File").withArgument(defaultFile).create());

    gBuilder.withOption(oBuilder.reset().withId(OPTION_G).withShortName("g").withLongName("genconf").withDescription(
        "Generate configuration file from pid").withArgument(pid2).create());

    FileValidator fValidator = VFSFileValidator.getExistingFileInstance().setBase(".");
    fValidator.setFile(false);
    // fValidator.setReadable(true);
View Full Code Here

TOP

Related Classes of org.apache.commons.cli2.builder.CommandBuilder

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.