Module repl

Source
Expand description

Create easy and well defined REPLs

A REPL is a Read-Eval-Print-Loop. Well known examples for REPLs are shells (like bash).

This module offers a convenient way to create a well-defined REPL without a lot of complicated code and with a visually pleasing aesthetic. An example REPL implementation can be found in the examples.

The basic idea is that the user defines the commands with an enum and uses claps #[derive(Subcommand)]. A loop is then used to read from the stdin into a buffer, that buffer is put to clap for parsing, similar to how clap would parse commandline arguments.

Modules§

error
Errors for the Repl module

Structs§

DefaultRepl
Default implementation for a REPL

Constants§

REPL_HELP_TEMPLATE
clap help template with only usage and commands/options

Traits§

Repl
Common Trait for repl objects