Class AbstractConsoleCommandExtension

java.lang.Object
org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension
All Implemented Interfaces:
ConsoleCommandExtension
Direct Known Subclasses:
ScriptEngineConsoleCommandExtension

@NonNullByDefault public abstract class AbstractConsoleCommandExtension extends Object implements ConsoleCommandExtension
A base class that should be used by console command extension for better inclusion.
Author:
Markus Rathgeb - Initial contribution
  • Constructor Details

    • AbstractConsoleCommandExtension

      public AbstractConsoleCommandExtension(String cmd, String desc)
      Generate a new console command extension.
      Parameters:
      cmd - The command the extension is used for.
      desc - The description what this extension is handling.
  • Method Details

    • getCommand

      public String getCommand()
      Description copied from interface: ConsoleCommandExtension
      Get the command of for the extension.
      Specified by:
      getCommand in interface ConsoleCommandExtension
      Returns:
      command for the extension
    • getDescription

      public String getDescription()
      Description copied from interface: ConsoleCommandExtension
      Get the description for the extension.
      Specified by:
      getDescription in interface ConsoleCommandExtension
      Returns:
      description for the extension
    • buildCommandUsage

      protected String buildCommandUsage(String description)
      Build a command usage string. You should always use that function to use a usage string that complies to a standard format.
      Parameters:
      description - the description of the command
      Returns:
      a usage string that complies to a standard format
    • buildCommandUsage

      protected String buildCommandUsage(String syntax, String description)
      Build a command usage string. You should always use that function to use a usage string that complies to a standard format.
      Parameters:
      syntax - the syntax format
      description - the description of the command
      Returns:
      a usage string that complies to a standard format
    • printUsage

      protected void printUsage(Console console)
      Print the whole usages to the console.
      Parameters:
      console - the console that should be used for output