[][src]Function molt_shell::repl

pub fn repl(interp: &mut Interp)

Invokes an interactive REPL for the given interpreter, using rustyline line editing.

The REPL will display a default prompt to the user. Press ^C to terminate the REPL, returning control to the caller. Entering exit will also normally cause the application to terminate (but the exit command can be removed or redefined by the application).

To change the prompt, set the tcl_prompt1 TCL variable to a script that returns the desired prompt.

See molt::interp for details on how to configure and add commands to a Molt interpreter.

Example

use molt::Interp;

// FIRST, create and initialize the interpreter.
let mut interp = Interp::new();

// NOTE: commands can be added to the interpreter here.

// NEXT, invoke the REPL.
molt_shell::repl(&mut interp);