pub struct Shell { /* private fields */ }Expand description
Represents the state of the interactive shell.
This struct holds the rustyline editor instance, the original directory from which
the shell was started, the path to the history file, and the path to the connected
database.
Implementations§
Source§impl Shell
impl Shell
Sourcepub fn new(db_path: &str) -> Result<Self>
pub fn new(db_path: &str) -> Result<Self>
Creates a new Shell instance.
This function initializes the rustyline editor, sets up the command completer,
loads the command history, and establishes a Ctrl+C handler.
§Arguments
db_path- The path to the database file, which is kept for context.
§Returns
A Result containing the new Shell instance, or an Err if initialization fails.
Sourcepub fn run(&mut self) -> ShellAction
pub fn run(&mut self) -> ShellAction
Runs the main loop of the shell.
This function displays the prompt, reads user input, and executes the entered
commands. It handles both built-in commands and external system commands.
The loop continues until the user enters exit or .vrepl.
§Returns
A ShellAction indicating the user’s intent to either exit the application
or switch back to the REPL.