Raxol.Terminal.Commands (Raxol v0.2.0)
View SourceFacade for the Terminal Commands functionality that maintains backward compatibility.
This module provides the same interface as the original CommandExecutor module but delegates to the refactored sub-modules. This allows for a smooth transition while code that depends on the original API is updated.
DEPRECATED: This module is provided for backward compatibility only. New code should use the appropriate sub-modules directly:
- Raxol.Terminal.Commands.Executor - Main entry point for executing commands
- Raxol.Terminal.Commands.Parser - For parsing command parameters
- Raxol.Terminal.Commands.Modes - For handling terminal mode setting/resetting
- Raxol.Terminal.Commands.Screen - For screen manipulation operations
- Raxol.Terminal.Commands.History - For command history management
Summary
Functions
Adds a command to the history.
Clears a line or part of a line based on the mode parameter.
Clears the screen or a part of it based on the mode parameter.
Deletes lines at the current cursor position.
Executes a CSI (Control Sequence Introducer) command.
Gets a parameter at a specific index from the params list.
Handles ANSI mode setting or resetting.
Handles DEC private mode setting or resetting.
Inserts blank lines at the current cursor position.
Creates a new command history manager.
Parses a raw parameter string buffer into a list of integers or nil values.
Retrieves the previous command in history.
Functions
Adds a command to the history.
This method delegates to the Commands.History module.
Parameters
history
- The history manager structcommand
- The command to add
Returns
- Updated history manager struct
Migration Path
Update your code to use the History module directly:
# Before
history = Raxol.Terminal.CommandHistory.add(history, "ls -la")
# After
history = Raxol.Terminal.Commands.History.add(history, "ls -la")
Clears a line or part of a line based on the mode parameter.
This method delegates to the Commands.Screen module.
Parameters
emulator
- The current emulator statemode
- The mode parameter (0, 1, or 2)
Returns
- Updated emulator state
Migration Path
Update your code to use the Screen module directly:
# Before
new_emulator = Raxol.Terminal.CommandExecutor.clear_line(emulator, 2)
# After
new_emulator = Raxol.Terminal.Commands.Screen.clear_line(emulator, 2)
Clears the screen or a part of it based on the mode parameter.
This method delegates to the Commands.Screen module.
Parameters
emulator
- The current emulator statemode
- The mode parameter (0, 1, 2, or 3)
Returns
- Updated emulator state
Migration Path
Update your code to use the Screen module directly:
# Before
new_emulator = Raxol.Terminal.CommandExecutor.clear_screen(emulator, 2)
# After
new_emulator = Raxol.Terminal.Commands.Screen.clear_screen(emulator, 2)
Deletes lines at the current cursor position.
This method delegates to the Commands.Screen module.
Parameters
emulator
- The current emulator statecount
- The number of lines to delete
Returns
- Updated emulator state
Migration Path
Update your code to use the Screen module directly:
# Before
new_emulator = Raxol.Terminal.CommandExecutor.delete_line(emulator, 2)
# After
new_emulator = Raxol.Terminal.Commands.Screen.delete_lines(emulator, 2)
Executes a CSI (Control Sequence Introducer) command.
This method delegates to the Commands.Executor module for the actual execution.
Parameters
emulator
- The current emulator stateparams_buffer
- The parameter portion of the CSI sequenceintermediates_buffer
- The intermediate bytes portion of the CSI sequencefinal_byte
- The final byte that determines the specific command
Returns
- Updated emulator state
Migration Path
Update your code to use the Executor module directly:
# Before
new_emulator = Raxol.Terminal.CommandExecutor.execute_csi_command(emulator, params, intermediates, final_byte)
# After
new_emulator = Raxol.Terminal.Commands.Executor.execute_csi_command(emulator, params, intermediates, final_byte)
Gets a parameter at a specific index from the params list.
This method delegates to the Commands.Parser module.
Parameters
params
- The list of parsed parametersindex
- The index to get the parameter fromdefault
- The default value to return if the parameter is nil or out of bounds
Returns
- The parameter value or the default value
Migration Path
Update your code to use the Parser module directly:
# Before
value = Raxol.Terminal.CommandExecutor.get_param(params, 1, 0)
# After
value = Raxol.Terminal.Commands.Parser.get_param(params, 1, 0)
Handles ANSI mode setting or resetting.
This method delegates to the Commands.Modes module.
Parameters
emulator
- The current emulator stateparams
- The parsed parametersaction
- The action to perform (:set or :reset)
Returns
- Updated emulator state
Migration Path
Update your code to use the Modes module directly:
# Before
new_emulator = Raxol.Terminal.CommandExecutor.handle_ansi_mode(emulator, params, :set)
# After
new_emulator = Raxol.Terminal.Commands.Modes.handle_ansi_mode(emulator, params, :set)
Handles DEC private mode setting or resetting.
This method delegates to the Commands.Modes module.
Parameters
emulator
- The current emulator stateparams
- The parsed parametersaction
- The action to perform (:set or :reset)
Returns
- Updated emulator state
Migration Path
Update your code to use the Modes module directly:
# Before
new_emulator = Raxol.Terminal.CommandExecutor.handle_dec_private_mode(emulator, params, :set)
# After
new_emulator = Raxol.Terminal.Commands.Modes.handle_dec_private_mode(emulator, params, :set)
Inserts blank lines at the current cursor position.
This method delegates to the Commands.Screen module.
Parameters
emulator
- The current emulator statecount
- The number of lines to insert
Returns
- Updated emulator state
Migration Path
Update your code to use the Screen module directly:
# Before
new_emulator = Raxol.Terminal.CommandExecutor.insert_line(emulator, 2)
# After
new_emulator = Raxol.Terminal.Commands.Screen.insert_lines(emulator, 2)
Creates a new command history manager.
This method delegates to the Commands.History module.
Parameters
max_size
- The maximum number of commands to store
Returns
- A new history manager struct
Migration Path
Update your code to use the History module directly:
# Before
history = Raxol.Terminal.CommandHistory.new(1000)
# After
history = Raxol.Terminal.Commands.History.new(1000)
Parses a raw parameter string buffer into a list of integers or nil values.
This method delegates to the Commands.Parser module for the actual parsing.
Parameters
params_string
- The raw parameter string from a CSI sequence
Returns
- A list of parsed parameters
Migration Path
Update your code to use the Parser module directly:
# Before
params = Raxol.Terminal.CommandExecutor.parse_params(params_string)
# After
params = Raxol.Terminal.Commands.Parser.parse_params(params_string)
Retrieves the previous command in history.
This method delegates to the Commands.History module.
Parameters
history