1pub mod loader;
2pub mod config;
3pub mod input;
4pub mod output;
5pub mod command;
6pub mod parser;
7pub mod console;
8pub mod shell_extensions;
9pub mod shell_commands;
10
11use crate::loader::CommandRegistry;
12pub use crate::command::Command as CliCustom;
13
14#[cfg(feature = "internal-commands")]
15pub mod commands;
16
17#[cfg(feature = "custom-commands")]
18pub mod custom;
19
20
21pub struct ModCli {
23 pub registry: CommandRegistry,
24}
25
26impl ModCli {
27 pub fn new() -> Self {
41 Self {
42 registry: CommandRegistry::new(),
43 }
44 }
45
46 pub fn set_prefix(&mut self, prefix: &str) {
48 self.registry.set_prefix(prefix);
49 }
50
51 pub fn get_prefix(&self) -> &str {
53 self.registry.get_prefix()
54 }
55
56 pub fn with_config(path: &str) -> Self {
58 config::set_path(path);
59 Self::new()
60 }
61
62 pub fn run(&mut self, args: Vec<String>) {
63 if args.is_empty() {
64 eprintln!("No command provided.");
65 return;
66 }
67
68 let command = &args[0];
69 let rest = &args[1..];
70
71 self.registry.execute(command, rest);
72 }
73}
74
75pub fn modcli_version() -> &'static str {
77 env!("CARGO_PKG_VERSION")
78}