Class CommandInput


  • public class CommandInput
    extends java.lang.Object
    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.
    • Constructor Summary

      Constructors 
      Constructor Description
      CommandInput​(java.lang.String command, java.lang.Object[] xargs, CommandRegistry.CommandSession session)
      Creates a new CommandInput with the specified command, arguments, and session.
      CommandInput​(java.lang.String command, java.lang.Object[] args, org.jline.terminal.Terminal terminal, java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
      Creates a new CommandInput with the specified command, arguments, terminal, and I/O streams.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] args()
      Returns the command arguments as strings.
      java.lang.String command()
      Returns the command name.
      java.io.PrintStream err()
      Returns the error stream for this command.
      java.io.InputStream in()
      Returns the input stream for this command.
      java.io.PrintStream out()
      Returns the output stream for this command.
      CommandRegistry.CommandSession session()
      Creates and returns a new CommandSession using this command's terminal and I/O streams.
      org.jline.terminal.Terminal terminal()
      Returns the terminal instance for this command.
      java.lang.Object[] xargs()
      Returns the original command arguments as objects.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommandInput

        public CommandInput​(java.lang.String command,
                            java.lang.Object[] xargs,
                            CommandRegistry.CommandSession session)
        Creates a new CommandInput with the specified command, arguments, and session.
        Parameters:
        command - the command name
        xargs - the command arguments as objects
        session - the command session containing terminal and I/O streams
      • CommandInput

        public CommandInput​(java.lang.String command,
                            java.lang.Object[] args,
                            org.jline.terminal.Terminal terminal,
                            java.io.InputStream in,
                            java.io.PrintStream out,
                            java.io.PrintStream err)
        Creates a new CommandInput with the specified command, arguments, terminal, and I/O streams.
        Parameters:
        command - the command name
        args - the command arguments as objects
        terminal - the terminal instance
        in - the input stream
        out - the output stream
        err - the error stream
    • Method Detail

      • command

        public java.lang.String command()
        Returns the command name.
        Returns:
        the command name
      • args

        public java.lang.String[] args()
        Returns the command arguments as strings.
        Returns:
        the command arguments as strings
      • xargs

        public java.lang.Object[] xargs()
        Returns the original command arguments as objects.
        Returns:
        the command arguments as objects
      • terminal

        public org.jline.terminal.Terminal terminal()
        Returns the terminal instance for this command.
        Returns:
        the terminal instance
      • in

        public java.io.InputStream in()
        Returns the input stream for this command.
        Returns:
        the input stream
      • out

        public java.io.PrintStream out()
        Returns the output stream for this command.
        Returns:
        the output stream
      • err

        public java.io.PrintStream err()
        Returns the error stream for this command.
        Returns:
        the error stream
      • session

        public CommandRegistry.CommandSession session()
        Creates and returns a new CommandSession using this command's terminal and I/O streams.
        Returns:
        a new command session