org.apache.commons.cli2.builder.GroupBuilder Java Examples

The following examples show how to use org.apache.commons.cli2.builder.GroupBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CmdRevert.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("revert")
            .withName("rev")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(OPT_QUIET)
                    .withOption(optRecursive = new DefaultOptionBuilder()
                            .withShortName("R")
                            .withLongName("recursive")
                            .withDescription("descend recursively")
                            .create())
                    .withOption(argLocalPath = new ArgumentBuilder()
                            .withName("file")
                            .withDescription("file or directory to revert")
                            .withMinimum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #2
Source File: CmdSave.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("save")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argJcrPath = new ArgumentBuilder()
                            .withName("jcr-path")
                            .withDescription("the jcr path")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #3
Source File: CmdRm.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("rm")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optRecursive = new DefaultOptionBuilder()
                            .withShortName("r")
                            .withDescription("remove the directory artifacts recursively")
                            .create())
                    .withOption(argPath = new ArgumentBuilder()
                            .withName("path")
                            .withDescription("the jcrfs path")
                            .withMinimum(1)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #4
Source File: CmdVaultDebug.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("vltdebug")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(OPT_VERBOSE)
                    .withOption(OPT_QUIET)
                    .withOption(argCommand = new ArgumentBuilder()
                            .withName("cmd")
                            .withDescription("command")
                            .withMinimum(0)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #5
Source File: CmdConnect.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("connect")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optForce = new DefaultOptionBuilder()
                            .withShortName("f")
                            .withDescription("force reconnect if already connected")
                            .create())
                    .withOption(argURI = new ArgumentBuilder()
                            .withName("rmiuri")
                            .withDescription("the rmi uri of the repository")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #6
Source File: CmdPropList.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("proplist")
            .withName("pl")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(OPT_QUIET)
                    .withOption(optRecursive = new DefaultOptionBuilder()
                            .withShortName("R")
                            .withLongName("recursive")
                            .withDescription("descend recursively")
                            .create())
                    .withOption(argLocalPath = new ArgumentBuilder()
                            .withName("file")
                            .withDescription("file or directory to list the properties from")
                            .withMinimum(1)
                            .create())
                    .create()
            )
            .create();
}
 
Example #7
Source File: CmdLsJcrFs.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("ls")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optTime = new DefaultOptionBuilder()
                            .withShortName("t")
                            .withDescription("display the last modification date")
                            .create())
                    .withOption(optSize = new DefaultOptionBuilder()
                            .withShortName("s")
                            .withDescription("display the file size")
                            .create())
                    .withOption(optMime = new DefaultOptionBuilder()
                            .withShortName("m")
                            .withDescription("display the mime type")
                            .create())
                    .withOption(optLong = new DefaultOptionBuilder()
                            .withShortName("l")
                            .withDescription("combines all format flags")
                            .create())
                    .withOption(argPath)
                    .create())
            .create();
}
 
Example #8
Source File: CmdRefresh.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("refresh")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optKeepChanges = new DefaultOptionBuilder()
                            .withShortName("k")
                            .withDescription("keep changes")
                            .create())
                    .withOption(argJcrPath = new ArgumentBuilder()
                            .withName("jcr-path")
                            .withDescription("the jcr path")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #9
Source File: CmdTree.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("tree")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optRecursive = new DefaultOptionBuilder()
                            .withShortName("r")
                            .withDescription("limit depth")
                            .withArgument(new ArgumentBuilder()
                                    .withName("depth")
                                    .withDescription("limit tree to <depth>")
                                    .withMinimum(1)
                                    .withMaximum(1)
                                    .withValidator(NumberValidator.getIntegerInstance())
                                    .create())
                            .create())
                    .withOption(argPath = new ArgumentBuilder()
                                    .withName("path")
                                    .withDescription("the path of the tree")
                                    .withMinimum(0)
                                    .withMaximum(1)
                                    .create())
                    .create())
            .create();
}
 
Example #10
Source File: CmdSet.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("set")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argKey= new ArgumentBuilder()
                            .withName("key")
                            .withDescription("name of the property")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .withOption(argValue= new ArgumentBuilder()
                            .withName("value")
                            .withDescription("value of the property. " +
                                    "If empty the property will be deleted")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #11
Source File: CmdInfo.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("info")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(OPT_VERBOSE)
                    .withOption(OPT_QUIET)
                    .withOption(optRecursive = new DefaultOptionBuilder()
                            .withShortName("R")
                            .withLongName("recursive")
                            .withDescription("operate recursive")
                            .create())
                    .withOption(argLocalPath = new ArgumentBuilder()
                            .withName("file")
                            .withDescription("file or directory to display info")
                            .withMinimum(0)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #12
Source File: CmdCat.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("cat")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argJcrPath = new ArgumentBuilder()
                            .withName("jcr-path")
                            .withDescription("the jcr path")
                            .withMinimum(1)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #13
Source File: CmdInvalidate.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("invalidate")
            .withName("inv")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argJcrPath = new ArgumentBuilder()
                            .withName("jcr-path")
                            .withDescription("the jcr path")
                            .withMinimum(1)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #14
Source File: CmdDelete.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("delete")
            .withName("del")
            .withName("rm")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(OPT_VERBOSE)
                    .withOption(OPT_QUIET)
                    .withOption(optForce = new DefaultOptionBuilder()
                            .withLongName("force")
                            .withDescription("force operation to run")
                            .create())
                    .withOption(argLocalPath = new ArgumentBuilder()
                            .withName("file")
                            .withDescription("file or directory to delete")
                            .withMinimum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #15
Source File: CmdDiff.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("diff")
            .withName("di")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optNonRecursive = new DefaultOptionBuilder()
                            .withShortName("N")
                            .withLongName("non-recursive")
                            .withDescription("operate on single directory")
                            .create())
                    .withOption(argLocalPath = new ArgumentBuilder()
                            .withName("file")
                            .withDescription("file or directory to display the diffs from")
                            .withMinimum(0)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #16
Source File: CmdDebug.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("debug")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argCommand = new ArgumentBuilder()
                            .withName("cmd")
                            .withDescription("the sub command")
                            .withMinimum(1)
                            .withMaximum(1)
                            .create()
                    )
                    .withOption(argArgs = new ArgumentBuilder()
                            .withName("args")
                            .withDescription("command arguments")
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #17
Source File: CmdDump.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("dump")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optConfig = new DefaultOptionBuilder()
                            .withShortName("c")
                            .withLongName("config")
                            .withDescription("writes the config to the local file")
                            .create())
                    .withOption(optFilter = new DefaultOptionBuilder()
                            .withShortName("f")
                            .withLongName("filter")
                            .withDescription("writes the workspace filter to the local file")
                            .create())
                    .withOption(argPath = new ArgumentBuilder()
                            .withName("path")
                            .withDescription("the path")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create())
                    .create())
            .create();
}
 
Example #18
Source File: CmdLsRepo.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("ls")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optNodeType = new DefaultOptionBuilder()
                            .withShortName("n")
                            .withDescription("display the node type of the nodes")
                            .create())
                    .withOption(optUUID = new DefaultOptionBuilder()
                            .withShortName("u")
                            .withDescription("display the uuid of the referenceable nodes")
                            .create())
                    .withOption(optLong = new DefaultOptionBuilder()
                            .withShortName("l")
                            .withDescription("combines the flags 'n' and 'u'")
                            .create())
                    .withOption(argPath)
                    .create())
            .create();
}
 
Example #19
Source File: CmdHello.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("hello")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argName = new ArgumentBuilder()
                            .withName("name")
                            .withDescription("print this name. default is 'world'")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #20
Source File: CmdHelp.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("help")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argCommand = new ArgumentBuilder()
                            .withName("command")
                            .withDescription("prints the help for the given command")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #21
Source File: CmdLoad.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("load")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argFile = new ArgumentBuilder()
                            .withName("file")
                            .withDescription("specifies the config file. default is \"" + AbstractApplication.DEFAULT_CONF_FILENAME + "\"")
                            .withMinimum(0)
                            .withMaximum(1)
                            .withValidator(FileValidator.getExistingFileInstance())
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #22
Source File: ExecutionContext.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
public Group getCommandsGroup() {
    if (grpCommands == null) {
        try {
            GroupBuilder gbuilder = new GroupBuilder()
                    .withName("Commands:")
                    .withMinimum(0)
                    .withMaximum(1);
            Iterator iter = commands.iterator();
            while (iter.hasNext()) {
                CliCommand c = (CliCommand) iter.next();
                gbuilder.withOption(c.getCommand());
            }
            grpCommands = gbuilder.create();
        } catch (Exception e) {
            log.error("Error while building command group.", e);
            throw new ExecutionException("Error while building command gorup.", e);
        }
    }
    return grpCommands;
}
 
Example #23
Source File: CmdExec.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("exec")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argMacro = new ArgumentBuilder()
                            .withName("macro")
                            .withDescription(
                                    "specifies the command stored in the environment property" +
                                    " 'macro.<macro>'.")
                            .withMinimum(1)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #24
Source File: CmdCtx.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("ctx")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argContext = new ArgumentBuilder()
                            .withName("context")
                            .withDescription("change to the given context. if empty display list.")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #25
Source File: CmdStore.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("store")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(argFile = new ArgumentBuilder()
                            .withName("file")
                            .withDescription("specifies the config file. default is \"" + AbstractApplication.DEFAULT_CONF_FILENAME + "\"")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #26
Source File: CmdConsole.java    From jackrabbit-filevault with Apache License 2.0 6 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("console")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(new DefaultOptionBuilder()
                            .withShortName("F")
                            .withLongName("console-settings")
                            .withDescription("specifies the console settings file. default is \"" + AbstractApplication.DEFAULT_CONF_FILENAME + "\"")
                            .withArgument(argFile = new ArgumentBuilder()
                            .withName("file")
                            .withMinimum(1)
                            .withMaximum(1)
                            .withValidator(FileValidator.getExistingFileInstance())
                            .create())
                            .create()
                            )
                    .create())
            .create();
}
 
Example #27
Source File: CmdGet.java    From jackrabbit-filevault with Apache License 2.0 5 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("get")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optForce = new DefaultOptionBuilder()
                            .withShortName("f")
                            .withDescription("force overwrite if local file already exists")
                            .create())
                    .withOption(argJcrPath = new ArgumentBuilder()
                            .withName("jcrl-path")
                            .withDescription("the jcr path")
                            .withMinimum(1)
                            .withMaximum(1)
                            .create()
                    )
                    .withOption(argLocalPath = new ArgumentBuilder()
                            .withName("local-path")
                            .withDescription("the local path")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #28
Source File: CmdImportCli.java    From jackrabbit-filevault with Apache License 2.0 5 votes vote down vote up
protected Command createCommand() {
    return new CommandBuilder()
            .withName("import")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(OPT_VERBOSE)
                    .withOption(optSync = new DefaultOptionBuilder()
                            .withShortName("s")
                            .withLongName("sync")
                            .withDescription("put local files under vault control.")
                            .create())
                    .withOption(optSysView = new DefaultOptionBuilder()
                            .withLongName("sysview")
                            .withDescription("specifies that the indicated local file has the sysview format")
                            .create())
                    .withOption(argMountpoint = new ArgumentBuilder()
                            .withName("uri")
                            .withDescription("mountpoint uri")
                            .withMinimum(1)
                            .withMaximum(1)
                            .create())
                    .withOption(argLocalPath = new ArgumentBuilder()
                            .withName("local-path")
                            .withDescription("the local path")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .withOption(argJcrPath = new ArgumentBuilder()
                            .withName("jcr-path")
                            .withDescription("the jcr path")
                            .withMinimum(0)
                            .withMaximum(1)
                            .create()
                    )
                    .create()
            )
            .create();
}
 
Example #29
Source File: CmdFormatCli.java    From jackrabbit-filevault with Apache License 2.0 5 votes vote down vote up
@Override
protected Command createCommand() {
    return new CommandBuilder()
            .withName("format")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withOption(CliCommand.OPT_VERBOSE)
                    .withOption(optCheckOnly = new DefaultOptionBuilder()
                        .withShortName("c")
                        .withLongName("check-only")
                        .withDescription("Only check the format.")
                        .create()
                    )
                    .withOption(optPatterns = new DefaultOptionBuilder()
                            .withShortName("p")
                            .withLongName("pattern")
                            .withDescription("pattern for recursive format. defaults to match all xml files.")
                            .withArgument(new ArgumentBuilder()
                                    .withMinimum(0)
                                    .withConsumeRemaining("**dummy**")
                                    .create())
                            .create())
                    .withOption(argPaths = new ArgumentBuilder()
                            .withName("paths")
                            .withDescription("files or directories to format.")
                            .withMinimum(0)
                            .create()
                    )
                    .create())
            .create();
}
 
Example #30
Source File: CmdCheckout.java    From jackrabbit-filevault with Apache License 2.0 5 votes vote down vote up
protected Command createCommand() {
    argJcrPath = new ArgumentBuilder()
        .withName("jcrPath")
        .withDescription("remote path")
        .withMinimum(1)
        .withMaximum(1)
        .create();
    argLocalPath = new ArgumentBuilder()
        .withName("localPath")
        .withDescription("local path (optional)")
        .withMinimum(0)
        .withMaximum(1)
        .create();
    return new CommandBuilder()
            .withName("checkout")
            .withName("co")
            .withDescription(getShortDescription())
            .withChildren(new GroupBuilder()
                    .withName("Options:")
                    .withOption(optForce = new DefaultOptionBuilder()
                            .withLongName("force")
                            .withDescription("force checkout to overwrite local files if they already exist.")
                            .create())
                    .withOption(OPT_VERBOSE)
                    .withOption(OPT_QUIET)
                    .withOption(argJcrPath)
                    .withOption(argLocalPath)
                    .create()
            )
            .create();
}