public class CLIParser extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
CLIParser.Command
Bean that represents a parsed command.
|
| Constructor and Description |
|---|
CLIParser(java.lang.String cliName,
java.lang.String[] cliHelp)
Create a parser.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCommand(java.lang.String command,
java.lang.String argsHelp,
java.lang.String commandHelp,
org.apache.commons.cli.Options commandOptions,
boolean hasArguments)
Add a command to the parser.
|
CLIParser.Command |
parse(java.lang.String[] args)
Parse a array of arguments into a command.
|
java.lang.String |
shortHelp() |
void |
showHelp(org.apache.commons.cli.CommandLine commandLine)
Print the help for the parser to standard output.
|
void |
validdateArgs(java.lang.String[] args,
java.lang.String[] minusCommand) |
public CLIParser(java.lang.String cliName, java.lang.String[] cliHelp)
cliName - name of the parser, for help purposes.cliHelp - help for the CLI.public void addCommand(java.lang.String command, java.lang.String argsHelp, java.lang.String commandHelp, org.apache.commons.cli.Options commandOptions, boolean hasArguments)
command - comand name.argsHelp - command arguments help.commandHelp - command description.commandOptions - command options.hasArguments - public CLIParser.Command parse(java.lang.String[] args) throws org.apache.commons.cli.ParseException
args - array of arguments.org.apache.commons.cli.ParseException - thrown if the arguments could not be parsed.public void validdateArgs(java.lang.String[] args, java.lang.String[] minusCommand) throws org.apache.commons.cli.ParseException
org.apache.commons.cli.ParseExceptionpublic java.lang.String shortHelp()
public void showHelp(org.apache.commons.cli.CommandLine commandLine)
commandLine - the command lineCopyright © 2018 Apache Software Foundation. All Rights Reserved.