Interface CommandContext
- All Known Implementing Classes:
CommandContext.DefaultCommandContext
public interface CommandContext
Interface containing information about current command execution.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionGets a command registration.<T> TgetOptionValue(String name) Gets an mapped option value.Gets a command option parser results.String[]Gets a raw args passed into a currently executing command.org.jline.terminal.TerminalGets a terminal.booleanhasMappedOption(String name) Gets if option has been mapped.static CommandContextof(String[] args, CommandParser.CommandParserResults results, org.jline.terminal.Terminal terminal, CommandRegistration commandRegistration) Gets an instance of a defaultCommandContext.
-
Method Details
-
getRawArgs
String[] getRawArgs()Gets a raw args passed into a currently executing command.- Returns:
- raw command arguments
-
hasMappedOption
Gets if option has been mapped.- Parameters:
name- the option name- Returns:
- true if option has been mapped, false otherwise
-
getParserResults
CommandParser.CommandParserResults getParserResults()Gets a command option parser results.- Returns:
- the command option parser results
-
getCommandRegistration
CommandRegistration getCommandRegistration()Gets a command registration.- Returns:
- the command registration
-
getOptionValue
Gets an mapped option value.- Type Parameters:
T- the type to map to- Parameters:
name- the option name- Returns:
- mapped value
-
getTerminal
org.jline.terminal.Terminal getTerminal()Gets a terminal.- Returns:
- a terminal
-
of
static CommandContext of(String[] args, CommandParser.CommandParserResults results, org.jline.terminal.Terminal terminal, CommandRegistration commandRegistration) Gets an instance of a defaultCommandContext.- Parameters:
args- the argumentsresults- the resultsterminal- the terminalcommandRegistration- the command registration- Returns:
- a command context
-