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
Nested ClassesModifier and TypeInterfaceDescriptionstatic classDefault implementation of aCommandParser.static classstatic interfaceResult of a parsingCommandOptionwith an argument.static interfaceResults of aCommandParser.static classDefault implementation of aCommandParser.CommandParserResult.static classDefault implementation of aCommandParser.CommandParserResults. -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandParserof(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
-