Class DefaultCommandParser

java.lang.Object
org.springframework.shell.core.command.DefaultCommandParser
All Implemented Interfaces:
CommandParser

public class DefaultCommandParser extends Object implements CommandParser
Default implementation of CommandParser. Supports options in the long form of --key=value or --key value as well in the short form of -k=value or -k value. Options and arguments can be specified in any order. Arguments are 0-based indexed among other arguments.
 CommandSyntax  ::= CommandName [SubCommandName]* [Option | Argument]*
 CommandName    ::= String
 SubCommandName ::= String
 Option         ::= ShortOption | LongOption
 ShortOption    ::= '-' Char ['='|' ']? String
 LongOption     ::= '--' String ['='|' ']? String
 Argument       ::= String

 Example: mycommand mysubcommand --optionA=value1 arg1 -b=value2 arg2 --optionC value3 -d value4

  If subcommands are used without options, then arguments must be separated using "--" (POSIX style):
  CommandSyntax  ::= CommandName [SubCommandName]* '--' [Argument]*

  Example: mycommand mysubcommand -- arg1 arg2
 
Since:
4.0.0
Author:
Mahmoud Ben Hassine, David Pilar
  • Constructor Details

    • DefaultCommandParser

      public DefaultCommandParser()
  • Method Details