Command

Trait Command 

Source
pub trait Command {
    // Required methods
    fn name(&self) -> &str;
    fn execute(&self, args: &[String]);

    // Provided methods
    fn aliases(&self) -> &[&str] { ... }
    fn help(&self) -> Option<&str> { ... }
    fn hidden(&self) -> bool { ... }
    fn required_caps(&self) -> &[&str] { ... }
    fn validate(&self, _args: &[String]) -> Result<(), String> { ... }
    fn execute_with(&self, args: &[String], _registry: &CommandRegistry) { ... }
}

Required Methods§

Source

fn name(&self) -> &str

Source

fn execute(&self, args: &[String])

Provided Methods§

Source

fn aliases(&self) -> &[&str]

Source

fn help(&self) -> Option<&str>

Source

fn hidden(&self) -> bool

Source

fn required_caps(&self) -> &[&str]

Capability requirements for visibility/authorization. The parent application grants capabilities at runtime on the registry. Default: no requirements.

Source

fn validate(&self, _args: &[String]) -> Result<(), String>

Source

fn execute_with(&self, args: &[String], _registry: &CommandRegistry)

Execute with access to the registry context. Default delegates to execute. Commands that need registry access (e.g., help) can override this.

Implementors§