modcli/commands/
help.rs

1use crate::command::Command;
2
3/// Built-in help command (execution handled by registry internally)
4pub struct HelpCommand;
5
6impl HelpCommand {
7    pub fn new() -> Self {
8        Self
9    }
10}
11
12impl Command for HelpCommand {
13    fn name(&self) -> &str {
14        "help"
15    }
16
17    fn aliases(&self) -> &[&str] {
18        &["--help", "-h"]
19    }
20
21    fn help(&self) -> Option<&str> {
22        Some("Displays help information")
23    }
24
25    fn validate(&self, args: &[String]) -> Result<(), String> {
26        if args.len() > 1 {
27            Err("Too many arguments. Usage: help [command]".into())
28        } else {
29            Ok(())
30        }
31    }
32
33    fn execute(&self, _args: &[String]) {
34        // Do nothing — real logic is handled inside registry.execute()
35    }
36}