Package javax0.repl
Interface CommandEnvironment
-
public interface CommandEnvironment
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LocalConsole
console()
java.lang.String
keyword()
java.lang.String
line()
java.util.regex.Matcher
matcher()
java.lang.String
matcherId()
Message
message()
ParameterParser
parser()
Repl
repl()
-
-
-
Method Detail
-
keyword
java.lang.String keyword()
- Returns:
- the keyword that was typed on the command line. If the user used an abbreviated form or an alias the returned string will be the abbreviated for or the alias itself and not the defined command name.
-
line
java.lang.String line()
- Returns:
- the part of the command line that comes after the user typed command name
-
parser
ParameterParser parser()
- Returns:
- the parameter parser that can be used to retrieve the parameters
-
matcher
java.util.regex.Matcher matcher()
- Returns:
- the matcher that was matching the line (the part of the line returned by the
line()
method. In case there was no regular expression matching the returned value is null.
-
matcherId
java.lang.String matcherId()
- Returns:
- the name of the regular expression that was matched. This name is given as a string in the command definition.
-
console
LocalConsole console()
- Returns:
- the console that can be used by the command to print output. Command should not use any other means to to directly output values to the user.
-
message
Message message()
- Returns:
- the message object that can be used to collect info, warning and error messagaes. These messages are displayed to the user when the command has finished.
-
repl
Repl repl()
- Returns:
- the Repl object that the command is running in. It is not likely that there are many Repl objects in a
single JVM? but still this is the preferred way to access the Repl object in case a command needs it. As an example
a command may switch debug mode in on the Repl calling
Repl.debug()
.
-
-