Class AbstractCommand

java.lang.Object
org.springframework.boot.cli.command.AbstractCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
HelpCommand, HintCommand, OptionParsingCommand, PromptCommand, ShellCommand, VersionCommand

public abstract class AbstractCommand extends Object implements Command
Abstract Command implementation.
Since:
1.0.0
Author:
Phillip Webb, Dave Syer
  • Constructor Details

    • AbstractCommand

      protected AbstractCommand(String name, String description)
      Create a new AbstractCommand instance.
      Parameters:
      name - the name of the command
      description - the command description
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Command
      Returns the name of the command.
      Specified by:
      getName in interface Command
      Returns:
      the command's name
    • getDescription

      public String getDescription()
      Description copied from interface: Command
      Returns a description of the command.
      Specified by:
      getDescription in interface Command
      Returns:
      the command's description
    • getUsageHelp

      public String getUsageHelp()
      Description copied from interface: Command
      Returns usage help for the command. This should be a simple one-line string describing basic usage. e.g. '[options] <file>'. Do not include the name of the command in this string.
      Specified by:
      getUsageHelp in interface Command
      Returns:
      the command's usage help
    • getHelp

      public String getHelp()
      Description copied from interface: Command
      Gets full help text for the command, e.g. a longer description and one line per option.
      Specified by:
      getHelp in interface Command
      Returns:
      the command's help text
    • getOptionsHelp

      public Collection<OptionHelp> getOptionsHelp()
      Description copied from interface: Command
      Returns help for each supported option.
      Specified by:
      getOptionsHelp in interface Command
      Returns:
      help for each of the command's options
    • getExamples

      public Collection<HelpExample> getExamples()
      Description copied from interface: Command
      Return some examples for the command.
      Specified by:
      getExamples in interface Command
      Returns:
      the command's examples