Interface CommandContext

All Known Implementing Classes:
CommandContext.DefaultCommandContext

public interface CommandContext
Interface containing information about current command execution.
  • Method Details

    • getRawArgs

      String[] getRawArgs()
      Gets a raw args passed into a currently executing command.
      Returns:
      raw command arguments
    • hasMappedOption

      boolean hasMappedOption(String name)
      Gets if option has been mapped.
      Parameters:
      name - the option name
      Returns:
      true if option has been mapped, false otherwise
    • 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

      <T> T getOptionValue(String name)
      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 default CommandContext.
      Parameters:
      args - the arguments
      results - the results
      terminal - the terminal
      commandRegistration - the command registration
      Returns:
      a command context