Interface CommandParser
- All Known Implementing Classes:
CommandParser.DefaultCommandParser
public interface CommandParser
Interface parsing arguments for a
CommandRegistration
. A command is
always identified by a set of words like
command subcommand1 subcommand2
and remaining part of it are options
which this interface intercepts and translates into format we can understand.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
static interface
Result of a parsingCommandOption
with an argument.static interface
Results of aCommandParser
.static class
Default implementation of aCommandParser
.static class
Default implementation of aCommandParser.CommandParserResult
.static class
Default implementation of aCommandParser.CommandParserResults
.static class
static class
-
Method Summary
Modifier and TypeMethodDescriptionstatic CommandParser
of()
Gets an instance of a default command parser.static CommandParser
of
(org.springframework.core.convert.ConversionService conversionService) Gets an instance of a default command parser.parse
(List<CommandOption> options, String[] args) Parse options with a given arguments.
-
Method Details
-
parse
Parse options with a given arguments. May throw various runtime exceptions depending how parser is configure. For example if required option is missing an exception is thrown.- Parameters:
options
- the command optionsargs
- the arguments- Returns:
- parsed results
-
of
Gets an instance of a default command parser.- Returns:
- instance of a default command parser
-
of
Gets an instance of a default command parser.- Parameters:
conversionService
- the conversion service- Returns:
- instance of a default command parser
-