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 Summary
ModifierConstructorDescriptionprotected
AbstractConsoleCommandExtension
(String cmd, String desc) Generate a new console command extension. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
buildCommandUsage
(String description) Build a command usage string.protected String
buildCommandUsage
(String syntax, String description) Build a command usage string.Get the command of for the extension.Get the description for the extension.protected void
printUsage
(Console console) Print the whole usages to the console.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openhab.core.io.console.extensions.ConsoleCommandExtension
execute, getCompleter, getUsages
-
Constructor Details
-
AbstractConsoleCommandExtension
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
Description copied from interface:ConsoleCommandExtension
Get the command of for the extension.- Specified by:
getCommand
in interfaceConsoleCommandExtension
- Returns:
- command for the extension
-
getDescription
Description copied from interface:ConsoleCommandExtension
Get the description for the extension.- Specified by:
getDescription
in interfaceConsoleCommandExtension
- Returns:
- description for the extension
-
buildCommandUsage
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
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 formatdescription
- the description of the command- Returns:
- a usage string that complies to a standard format
-
printUsage
Print the whole usages to the console.- Parameters:
console
- the console that should be used for output
-