Struct shrust::Shell
[−]
[src]
pub struct Shell<T> {
// some fields omitted
}A shell
Methods
impl<T> Shell<T>
fn new(data: T) -> Shell<T>
Create a new shell, wrapping data, using provided IO
fn data(&mut self) -> &mut T
Get a mutable pointer to the inner data
fn set_prompt(&mut self, prompt: String)
Change the current prompt
fn new_shell_command<S, F>(&mut self, name: S, description: S, nargs: usize, func: F) where S: ToString, F: Fn(&mut ShellIO, &mut Shell<T>, &[&str]) -> ExecResult + Send + Sync + 'static
Register a shell command. Shell commands get called with a reference to the current shell
fn new_command<S, F>(&mut self, name: S, description: S, nargs: usize, func: F) where S: ToString, F: Fn(&mut ShellIO, &mut T, &[&str]) -> ExecResult + Send + Sync + 'static
Register a command
fn new_command_noargs<S, F>(&mut self, name: S, description: S, func: F) where S: ToString, F: Fn(&mut ShellIO, &mut T) -> ExecResult + Send + Sync + 'static
Register a command that do not accept any argument
fn print_help(&self, io: &mut ShellIO) -> ExecResult
Print the help to stdout
fn get_history(&self) -> &History
Return the command history
fn eval(&mut self, io: &mut ShellIO, line: &str) -> ExecResult
Evaluate a command line
fn run_loop(&mut self, io: &mut ShellIO)
Enter the shell main loop, exiting only when the "quit" command is called