public class AeshCommandLineParser<C extends Command> extends java.lang.Object implements CommandLineParser<C>
CommandLine
It can also print a formatted usage/help information.| Modifier and Type | Field and Description |
|---|---|
private java.util.List<CommandLineParser<? extends Command>> |
childParsers |
private static java.lang.String |
EQUALS |
private boolean |
isChild |
private ProcessedCommand<C> |
processedCommand |
| Constructor and Description |
|---|
AeshCommandLineParser(ProcessedCommand<C> processedCommand) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChildParser(CommandLineParser<? extends Command> commandLineParser) |
private RequiredOptionException |
checkForMissingRequiredOptions(ProcessedCommand<C> command,
CommandLine<? extends Command> commandLine) |
void |
clear() |
boolean |
equals(java.lang.Object o) |
private ProcessedOption |
findLongOption(ProcessedCommand command,
java.lang.String line) |
private ProcessedOption |
findOption(ProcessedCommand command,
java.lang.String line) |
java.util.List<CommandLineParser<? extends Command>> |
getAllChildParsers() |
java.util.List<java.lang.String> |
getAllNames() |
CommandLineParser<? extends Command> |
getChildParser(java.lang.String name) |
C |
getCommand() |
CommandPopulator |
getCommandPopulator() |
CommandLineCompletionParser |
getCompletionParser() |
ProcessedCommand<C> |
getProcessedCommand() |
int |
hashCode() |
boolean |
isChild() |
boolean |
isGroupCommand() |
CommandLine<? extends Command> |
parse(AeshLine line,
boolean ignoreRequirements) |
CommandLine<? extends Command> |
parse(java.util.List<java.lang.String> lines,
boolean ignoreRequirements)
Parse a command line with the defined command as base of the rules.
|
CommandLine<? extends Command> |
parse(java.lang.String line)
Parse a command line with the defined command as base of the rules.
|
CommandLine<? extends Command> |
parse(java.lang.String line,
boolean ignoreRequirements)
Parse a command line with the defined command as base of the rules.
|
java.lang.String |
printHelp()
Returns a usage String based on the defined command and options.
|
void |
setChild(boolean child) |
java.lang.String |
toString() |
private final ProcessedCommand<C extends Command> processedCommand
private static final java.lang.String EQUALS
private java.util.List<CommandLineParser<? extends Command>> childParsers
private boolean isChild
public AeshCommandLineParser(ProcessedCommand<C> processedCommand)
public void addChildParser(CommandLineParser<? extends Command> commandLineParser)
addChildParser in interface CommandLineParser<C extends Command>public void setChild(boolean child)
setChild in interface CommandLineParser<C extends Command>public java.util.List<java.lang.String> getAllNames()
getAllNames in interface CommandLineParser<C extends Command>public boolean isChild()
public CommandLineParser<? extends Command> getChildParser(java.lang.String name)
getChildParser in interface CommandLineParser<C extends Command>name - commandpublic java.util.List<CommandLineParser<? extends Command>> getAllChildParsers()
getAllChildParsers in interface CommandLineParser<C extends Command>public ProcessedCommand<C> getProcessedCommand()
getProcessedCommand in interface CommandLineParser<C extends Command>public C getCommand()
getCommand in interface CommandLineParser<C extends Command>public CommandLineCompletionParser getCompletionParser()
getCompletionParser in interface CommandLineParser<C extends Command>public CommandPopulator getCommandPopulator()
getCommandPopulator in interface CommandLineParser<C extends Command>public java.lang.String printHelp()
printHelp in interface CommandLineParser<C extends Command>public CommandLine<? extends Command> parse(java.lang.String line)
CommandLine object where
they can be queried after.parse in interface CommandLineParser<C extends Command>line - inputpublic CommandLine<? extends Command> parse(AeshLine line, boolean ignoreRequirements)
parse in interface CommandLineParser<C extends Command>public CommandLine<? extends Command> parse(java.lang.String line, boolean ignoreRequirements)
CommandLine object where
they can be queried after.parse in interface CommandLineParser<C extends Command>line - inputignoreRequirements - if we should ignorepublic CommandLine<? extends Command> parse(java.util.List<java.lang.String> lines, boolean ignoreRequirements)
parse in interface CommandLineParser<C extends Command>lines - inputignoreRequirements - if we should ignoreprivate RequiredOptionException checkForMissingRequiredOptions(ProcessedCommand<C> command, CommandLine<? extends Command> commandLine)
private ProcessedOption findOption(ProcessedCommand command, java.lang.String line)
private ProcessedOption findLongOption(ProcessedCommand command, java.lang.String line)
public void clear()
clear in interface CommandLineParser<C extends Command>public boolean isGroupCommand()
isGroupCommand in interface CommandLineParser<C extends Command>public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object