execute_line

Function execute_line 

Source
pub fn execute_line(line: &str, shell_state: &mut ShellState)
Expand description

Process and execute a single shell command line.

This performs lexical analysis, alias expansion, brace expansion, parsing, and execution in sequence; prints errors (using the configured color scheme when enabled) and updates the shell state (including the last exit code and, on certain lex errors, exit request).

§Parameters

  • line: the input command line to process.
  • shell_state: mutable shell state used for options (e.g., verbose, colors), color output, and to store execution results such as the last exit code and exit-request flag.

§Examples

// Example usage (requires a configured ShellState):
let mut shell_state = state::ShellState::new();
execute_line("echo hello", &mut shell_state);
assert_eq!(shell_state.last_exit_code(), 0);