Trait cmdr::Scope

source ·
pub trait Scope {
    fn command(&mut self, line: Line<'_>) -> CommandResult;

    fn prompt(&self) -> String { ... }
    fn empty(&mut self) -> CommandResult { ... }
    fn default(&mut self, _line: Line<'_>) -> CommandResult { ... }
}
Expand description

Trait for implementing a Scope object. This trait can be implemented by a client but will most likely be implemented for you by the cmdr macro.

Required Methods

Execute a single line

Provided Methods

Return the prompt for this scope. The default implementation returns > as a prompt but thus can be overridden to return other strings or implement dynamically generated prompts

Execute an empty line. The default implentation does nothing but this can be overridden by a client-application to implement other behaviour

A user entered an unknown command. The default implementation prints an error to the user and returns ok to go on. Can be overridden by a client-application to implement other behaviour

Implementors