mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-31 13:34:24 +02:00
Provide Karaf Session object inside OSGiConsole (#4635)
The Karaf `Session` enables ConsoleCommandExtensions to prompt for user input. Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
+15
@@ -12,7 +12,10 @@
|
||||
*/
|
||||
package org.openhab.core.io.console;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* This interface must be implemented by consoles which want to use the {@link ConsoleInterpreter}.
|
||||
@@ -38,4 +41,16 @@ public interface Console {
|
||||
* @param s the main usage string (console independent)
|
||||
*/
|
||||
void printUsage(String s);
|
||||
|
||||
/**
|
||||
* Reads a line from the console. The prompt is displayed before the line is read.
|
||||
*
|
||||
* @param prompt the prompt to display
|
||||
* @param mask the character to use for masking input (e.g. '*'), or null if no masking is required
|
||||
* @return the line read from the console
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
default String readLine(String prompt, final @Nullable Character mask) throws IOException {
|
||||
throw new UnsupportedOperationException("readLine not supported");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user