Package core

Class ShellInputHandler

java.lang.Object
core.ShellInputHandler

public class ShellInputHandler extends Object
Handles the main shell loop, user input, prompt display, command history navigation, and tab completion.
  • Constructor Details

    • ShellInputHandler

      public ShellInputHandler(CommandHandler handler, String[] builtins, String pathEnv)
      Constructs a ShellInputHandler with the given command handler, builtins, and PATH environment.
      Parameters:
      handler - The CommandHandler instance.
      builtins - Array of builtin command names.
      pathEnv - The PATH environment variable.
  • Method Details

    • run

      public void run(Path currentDirectory) throws Exception
      Runs the main shell loop, reading user input, handling special keys, and delegating command execution.
      Parameters:
      currentDirectory - The initial working directory.
      Throws:
      Exception - if an error occurs during shell operation.