modcli/
lib.rs

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