Interface Command

All Known Implementing Classes:
SmithyCommand

public interface Command
Represents a CLI command.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Environment settings for the command.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    execute(Arguments arguments, Command.Env env)
    Executes the command using the provided arguments.
    default String
    Gets the long description of the command.
    Gets the name of the command.
    Gets a short summary of the command that's shown in the main help.
    default boolean
    Return true to hide this command from help output.
    void
    printHelp(Arguments arguments, ColorFormatter colors, CliPrinter printer)
    Prints help output.
  • Method Details

    • getName

      String getName()
      Gets the name of the command.

      The returned name should contain no spaces or special characters.

      Returns:
      Returns the command name.
    • isHidden

      default boolean isHidden()
      Return true to hide this command from help output.
      Returns:
      Return true if this is a hidden command.
    • getSummary

      String getSummary()
      Gets a short summary of the command that's shown in the main help.
      Returns:
      Returns the short help description.
    • getDocumentation

      default String getDocumentation(ColorFormatter colors)
      Gets the long description of the command.
      Parameters:
      colors - Color formatter to use for styling help.
      Returns:
      Returns the long description.
    • printHelp

      void printHelp(Arguments arguments, ColorFormatter colors, CliPrinter printer)
      Prints help output.
      Parameters:
      arguments - Arguments that have been parsed so far.
      colors - Color formatter to use.
      printer - Where to write help.
    • execute

      int execute(Arguments arguments, Command.Env env)
      Executes the command using the provided arguments.
      Parameters:
      arguments - CLI arguments.
      env - CLI environment settings like stdout, stderr, etc.
      Returns:
      Returns the exit code.