Package org.dellroad.jct.core.simple
Class SimpleCommandSupport
java.lang.Object
org.dellroad.jct.core.simple.SimpleCommandSupport
- Direct Known Subclasses:
SimpleExec,SimpleShell
Support superclass for console components that utilize
SimpleCommands.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a command line that has been parsed and the correspondingSimpleCommandfound. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBuild a combined command map, where command names in earlier bundles hide later ones.findCommand(PrintStream errout, String commandString) Find the command in the bundle corresponding to the given command string, which will be parsed.findCommand(PrintStream errout, List<String> commandList) Find the command in the bundle corresponding to the given command list.findCommand(PrintStream errout, ExecRequest request) Find the command in the bundle corresponding to the given request.Get the list of command bundles.Get the configured command line parser.voidsetCommandLineParser(CommandLineParser commandLineParser) Configure how command lines are parsed into separate arguments.
-
Field Details
-
commandLineParser
-
commandBundles
-
-
Constructor Details
-
SimpleCommandSupport
public SimpleCommandSupport()
-
-
Method Details
-
getCommandLineParser
Get the configured command line parser.- Returns:
- command line parser, never null
-
setCommandLineParser
Configure how command lines are parsed into separate arguments.By default, a
SimpleCommandLineParseris used.- Parameters:
commandLineParser- command line parser- Throws:
IllegalArgumentException- ifcommandLineParseris null
-
getCommandBundles
Get the list of command bundles.- Returns:
- command bundles, never null
-
buildCommandMap
Build a combined command map, where command names in earlier bundles hide later ones.- Returns:
- map from command name to command
-
findCommand
Find the command in the bundle corresponding to the given request.If an error occurs, an error message is printed to
erroutand null is returned.- Parameters:
errout- error outputrequest- exec request- Returns:
- successful parse and lookup, otherwise null
- Throws:
IllegalArgumentException- if either parameter is null
-
findCommand
Find the command in the bundle corresponding to the given command string, which will be parsed.If an error occurs, an error message is printed to
erroutand null is returned.- Parameters:
errout- error outputcommandString- command string- Returns:
- successful parse and lookup, otherwise null
- Throws:
IllegalArgumentException- if either parameter is null
-
findCommand
Find the command in the bundle corresponding to the given command list.If an error occurs, an error message is printed to
erroutand null is returned.- Parameters:
errout- error outputcommandList- command list- Returns:
- successful parse and lookup, otherwise null
- Throws:
IllegalArgumentException- if either parameter is null
-