Raxol.Terminal.CommandProcessor (Raxol v2.0.1)

View Source

Handles command processing for the terminal emulator. This module is responsible for parsing, validating, and executing terminal commands.

Summary

Functions

Executes a parsed command on the emulator. Returns {:ok, updated_emulator} or {:error, reason}.

Handles command execution errors. Returns {:ok, updated_emulator} with error state or {:error, reason}.

Processes a command string and executes it on the emulator. Returns {:ok, updated_emulator} or {:error, reason}.

Validates command parameters against the emulator's current state. Returns {:ok, validated_params} or {:error, reason}.

Functions

execute_command(emulator, command)

@spec execute_command(Raxol.Terminal.Emulator.t(), map()) ::
  {:ok, Raxol.Terminal.Emulator.t()} | {:error, String.t()}

Executes a parsed command on the emulator. Returns {:ok, updated_emulator} or {:error, reason}.

handle_command_error(emulator, reason)

@spec handle_command_error(Raxol.Terminal.Emulator.t(), String.t()) ::
  {:ok, Raxol.Terminal.Emulator.t()} | {:error, String.t()}

Handles command execution errors. Returns {:ok, updated_emulator} with error state or {:error, reason}.

process_command(emulator, command)

@spec process_command(Raxol.Terminal.Emulator.t(), String.t()) ::
  {:ok, Raxol.Terminal.Emulator.t()} | {:error, String.t()}

Processes a command string and executes it on the emulator. Returns {:ok, updated_emulator} or {:error, reason}.

validate_parameters(emulator, params, command_type)

@spec validate_parameters(Raxol.Terminal.Emulator.t(), list(), atom()) ::
  {:ok, list()} | {:error, String.t()}

Validates command parameters against the emulator's current state. Returns {:ok, validated_params} or {:error, reason}.