Package builtins

Class CdCommand

java.lang.Object
builtins.CdCommand
All Implemented Interfaces:
Command

public class CdCommand extends Object implements Command
Implements the 'cd' (change directory) builtin command.
  • Constructor Details

    • CdCommand

      public CdCommand()
      Constructs a new CdCommand instance. Initializes the built-in 'cd' (change directory) command.
  • Method Details

    • execute

      public Path execute(String[] args, String rawInput, Path currentDirectory)
      Changes the shell's current directory and returns the new path.
      Specified by:
      execute in interface Command
      Parameters:
      args - The command and its arguments.
      rawInput - The raw input string.
      currentDirectory - The current working directory.
      Returns:
      The new current directory after execution.