Package core

Class ShellHistory

java.lang.Object
core.ShellHistory

public class ShellHistory extends Object
Manages the command history buffer and navigation (up/down arrows).
  • Constructor Details

    • ShellHistory

      public ShellHistory()
      Constructs a new ShellHistory instance. Initializes the command history buffer and navigation index.
  • Method Details

    • add

      public void add(String command)
      Adds a command to history and resets the navigation index.
      Parameters:
      command - The command to add.
    • previous

      public String previous()
      Returns the previous command in history.
      Returns:
      The previous command, or an empty string if none.
    • next

      public String next()
      Returns the next command in history.
      Returns:
      The next command, or an empty string if none.
    • resetIndex

      public void resetIndex()
      Resets the navigation index to the most recent command.