Package org.jline.console
Class CommandInput
java.lang.Object
org.jline.console.CommandInput
Encapsulates the input and output streams for a command execution.
This class provides access to the command name, arguments, terminal, and I/O streams
needed for command execution in the console environment.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) String[]String representation of command arguments(package private) StringThe command name(package private) PrintStreamError stream for the command(package private) InputStreamInput stream for the command(package private) PrintStreamOutput stream for the command(package private) TerminalTerminal instance for the command(package private) Object[]Original object arguments -
Constructor Summary
ConstructorsConstructorDescriptionCommandInput(String command, Object[] xargs, CommandRegistry.CommandSession session) Creates a new CommandInput with the specified command, arguments, and session.CommandInput(String command, Object[] args, Terminal terminal, InputStream in, PrintStream out, PrintStream err) Creates a new CommandInput with the specified command, arguments, terminal, and I/O streams. -
Method Summary
Modifier and TypeMethodDescriptionString[]args()Returns the command arguments as strings.command()Returns the command name.err()Returns the error stream for this command.in()Returns the input stream for this command.out()Returns the output stream for this command.session()Creates and returns a new CommandSession using this command's terminal and I/O streams.terminal()Returns the terminal instance for this command.Object[]xargs()Returns the original command arguments as objects.
-
Field Details
-
command
String commandThe command name -
args
String[] argsString representation of command arguments -
xargs
Object[] xargsOriginal object arguments -
terminal
Terminal terminalTerminal instance for the command -
in
InputStream inInput stream for the command -
out
PrintStream outOutput stream for the command -
err
PrintStream errError stream for the command
-
-
Constructor Details
-
CommandInput
Creates a new CommandInput with the specified command, arguments, and session.- Parameters:
command- the command namexargs- the command arguments as objectssession- the command session containing terminal and I/O streams
-
CommandInput
public CommandInput(String command, Object[] args, Terminal terminal, InputStream in, PrintStream out, PrintStream err) Creates a new CommandInput with the specified command, arguments, terminal, and I/O streams.- Parameters:
command- the command nameargs- the command arguments as objectsterminal- the terminal instancein- the input streamout- the output streamerr- the error stream
-
-
Method Details
-
command
Returns the command name.- Returns:
- the command name
-
args
Returns the command arguments as strings.- Returns:
- the command arguments as strings
-
xargs
Returns the original command arguments as objects.- Returns:
- the command arguments as objects
-
terminal
Returns the terminal instance for this command.- Returns:
- the terminal instance
-
in
Returns the input stream for this command.- Returns:
- the input stream
-
out
Returns the output stream for this command.- Returns:
- the output stream
-
err
Returns the error stream for this command.- Returns:
- the error stream
-
session
Creates and returns a new CommandSession using this command's terminal and I/O streams.- Returns:
- a new command session
-