Package org.apache.storm.command
Class CLI.CLIBuilder
java.lang.Object
org.apache.storm.command.CLI.CLIBuilder
- Enclosing class:
- CLI
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd a named argument.Add a named argument.Add a named argument.Add a named argument.Add a boolean option that enables something.Add an option to be parsed.Add an option to be parsed.Add an option to be parsed.optionalArg
(String name) Add a named argument that is optional.optionalArg
(String name, CLI.Assoc assoc) Add a named argument that is optional.optionalArg
(String name, CLI.Parse parse) Add a named argument that is optional.optionalArg
(String name, CLI.Parse parse, CLI.Assoc assoc) Add a named argument that is optional.Parse the command line arguments.
-
Constructor Details
-
CLIBuilder
public CLIBuilder()
-
-
Method Details
-
opt
Add an option to be parsed.- Parameters:
shortName
- the short single character name of the option (no `-` character proceeds it).longName
- the multi character name of the option (no `--` characters proceed it).defaultValue
- the value that will be returned of the command if none is given. null if none is given.- Returns:
- a builder to be used to continue creating the command line.
-
opt
Add an option to be parsed.- Parameters:
shortName
- the short single character name of the option (no `-` character proceeds it).longName
- the multi character name of the option (no `--` characters proceed it).defaultValue
- the value that will be returned of the command if none is given. null if none is given.parse
- an optional function to transform the string to something else. If null a NOOP is used.- Returns:
- a builder to be used to continue creating the command line.
-
opt
public CLI.CLIBuilder opt(String shortName, String longName, Object defaultValue, CLI.Parse parse, CLI.Assoc assoc) Add an option to be parsed.- Parameters:
shortName
- the short single character name of the option (no `-` character proceeds it).longName
- the multi character name of the option (no `--` characters proceed it).defaultValue
- the value that will be returned of the command if none is given. null if none is given.parse
- an optional function to transform the string to something else. If null a NOOP is used.assoc
- an association command to decide what to do if the option appears multiple times. If null LAST_WINS is used.- Returns:
- a builder to be used to continue creating the command line.
-
boolOpt
Add a boolean option that enables something.- Parameters:
shortName
- the short single character name of the option (no `-` character proceeds it).longName
- the multi character name of the option (no `--` characters proceed it).- Returns:
- a builder to be used to continue creating the command line.
-
arg
Add a named argument.- Parameters:
name
- the name of the argument.- Returns:
- a builder to be used to continue creating the command line.
-
arg
Add a named argument.- Parameters:
name
- the name of the argument.assoc
- an association command to decide what to do if the argument appears multiple times. If null INTO_LIST is used.- Returns:
- a builder to be used to continue creating the command line.
-
arg
Add a named argument.- Parameters:
name
- the name of the argument.parse
- an optional function to transform the string to something else. If null a NOOP is used.- Returns:
- a builder to be used to continue creating the command line.
-
arg
Add a named argument.- Parameters:
name
- the name of the argument.parse
- an optional function to transform the string to something else. If null a NOOP is used.assoc
- an association command to decide what to do if the argument appears multiple times. If null INTO_LIST is used.- Returns:
- a builder to be used to continue creating the command line.
-
optionalArg
Add a named argument that is optional.- Parameters:
name
- the name of the argument.- Returns:
- a builder to be used to continue creating the command line.
-
optionalArg
Add a named argument that is optional.- Parameters:
name
- the name of the argument.assoc
- an association command to decide what to do if the argument appears multiple times. If null INTO_LIST is used.- Returns:
- a builder to be used to continue creating the command line.
-
optionalArg
Add a named argument that is optional.- Parameters:
name
- the name of the argument.parse
- an optional function to transform the string to something else. If null a NOOP is used.- Returns:
- a builder to be used to continue creating the command line.
-
optionalArg
Add a named argument that is optional.- Parameters:
name
- the name of the argument.parse
- an optional function to transform the string to something else. If null a NOOP is used.assoc
- an association command to decide what to do if the argument appears multiple times. If null INTO_LIST is used.- Returns:
- a builder to be used to continue creating the command line.
-
parse
Parse the command line arguments.- Parameters:
rawArgs
- the string arguments to be parsed.- Returns:
- The parsed command line. opts will be stored under the short argument name. args will be stored under the argument name, unless no arguments are configured, and then they will be stored under "ARGS". The last argument configured is greedy and is used to process all remaining command line arguments.
- Throws:
Exception
- on any error.
-