Interface CommandParser
- All Known Implementing Classes:
CommandParser.AstCommandParser
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
Modifier and TypeInterfaceDescriptionstatic class
Default implementation of aCommandParser
.static class
static interface
Result of a parsingCommandOption
with an argument.static interface
Results of aCommandParser
.static class
Default implementation of aCommandParser.CommandParserResult
.static class
Default implementation of aCommandParser.CommandParserResults
. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandParser
of
(org.springframework.core.convert.ConversionService conversionService, Map<String, CommandRegistration> registrations, ParserConfig config) Gets an instance of a default command parser.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:
args
- the arguments- Returns:
- parsed results
-
of
static CommandParser of(org.springframework.core.convert.ConversionService conversionService, Map<String, CommandRegistration> registrations, ParserConfig config) Gets an instance of a default command parser.- Parameters:
conversionService
- the conversion serviceregistrations
- the command registrationsconfig
- the parser config- Returns:
- instance of a default command parser
-