modcli/
lib.rs

1pub mod command;
2pub mod parser;
3pub mod loader;
4pub mod output;
5
6#[cfg(feature = "internal-commands")]
7pub mod commands;
8
9use loader::CommandRegistry;
10
11/// Main CLI framework interface
12pub struct ModCli {
13    pub registry: CommandRegistry,
14}
15
16impl ModCli {
17    /// Creates a new CLI instance with registered commands
18    pub fn new() -> Self {
19        Self {
20            registry: CommandRegistry::new(),
21        }
22    }
23
24    /// Runs the CLI logic with given args
25    pub fn run(&mut self, args: Vec<String>) {
26        if args.is_empty() {
27            eprintln!("No command provided.");
28            return;
29        }
30
31        let cmd = &args[0];
32        let cmd_args = &args[1..];
33        self.registry.execute(cmd, cmd_args);
34    }
35}