Trait shellfish::handler::default::Handler[][src]

pub trait Handler<T> {
    fn handle(
        &self,
        args: Vec<String>,
        commands: &HashMap<&str, Command<T>>,
        state: &mut T,
        description: &str
    ) -> bool; }
Expand description

A handler lets you change how commands are run. They also let you change the shell built-ins. A handler takes a Vec as input, and return a bool. A handler also takes a HashMap<String, Commands>, so it knows what commands it can run. Likewise, the state is also given.

The bool sent in return is wether or not this command should quit the shell. For example, in default shellfish, true is only every returned when the commands quit or exit are given.

For nearly every use case the default handler should be enough. If in doubt, you can create your own. I would recommend looking at shellfish’s source code for an example

Required methods

Implementors