public interface App_CliParser
Base for a CLI parser.
| Modifier and Type | Method and Description |
|---|---|
default App_CliParser |
addAllOptions(Iterable<?> options)
Adds all options to the parser.
|
default App_CliParser |
addAllOptions(Object[] options)
Adds all options to the parser.
|
App_CliParser |
addOption(Object option)
Adds a new option to the parser.
|
Set<String> |
getAddedOptions()
Returns the options already added, short or long.
|
Set<ApoBaseC> |
getAllOptions()
Returns a set of all options.
|
Set<Apo_SimpleC> |
getSimpleOptions()
Returns all simple options added to the parser.
|
Set<Apo_TypedC<?>> |
getTypedOptions()
Returns all typed options added to the parser.
|
default boolean |
hasOption(ApoBase option)
Tests if an option is already added to the command line parser.
|
int |
numberLong()
Statistic method: returns number of CLI arguments with long option.
|
int |
numberShort()
Statistic method: returns number of CLI arguments with short option.
|
void |
parse(String[] args)
Parses command line arguments set values for CLI options.
|
default ArrayList<StrBuilder> |
usage()
Prints usage information for the CLI parser including all CLI options.
|
default ArrayList<StrBuilder> |
usage(int width)
Prints usage information for the CLI parser including all CLI options.
|
int numberShort()
Statistic method: returns number of CLI arguments with short option.
int numberLong()
Statistic method: returns number of CLI arguments with long option.
default App_CliParser addAllOptions(Object[] options) throws IllegalStateException
Adds all options to the parser.
options - the options to be added, ignored if null, any null element is ignored as wellIllegalStateException - if the option is already in usedefault App_CliParser addAllOptions(Iterable<?> options) throws IllegalStateException
Adds all options to the parser.
options - the options to be added, ignored if null, any null element is ignored as wellIllegalStateException - if the option is already in useApp_CliParser addOption(Object option) throws IllegalStateException
Adds a new option to the parser.
option - the option to be added, ignored if nullIllegalStateException - if the option is already in useSet<String> getAddedOptions()
Returns the options already added, short or long.
Set<Apo_SimpleC> getSimpleOptions()
Returns all simple options added to the parser.
Set<Apo_TypedC<?>> getTypedOptions()
Returns all typed options added to the parser.
Set<ApoBaseC> getAllOptions()
Returns a set of all options.
default boolean hasOption(ApoBase option)
Tests if an option is already added to the command line parser.
option - the option to test fornull or not an instance of ApoBaseCvoid parse(String[] args) throws CliParseException, IllegalStateException
Parses command line arguments set values for CLI options.
args - command line argumentsCliParseException - if a parsing error happened, for instance a required option was not present in the argumentsIllegalStateException - if a parsing error happened, for instance a required option was not present in the argumentsdefault ArrayList<StrBuilder> usage(int width)
Prints usage information for the CLI parser including all CLI options.
width - the console columns or width of each output linedefault ArrayList<StrBuilder> usage()
Prints usage information for the CLI parser including all CLI options.
Copyright © 2016–2017. All rights reserved.