···11+[package]
22+name = "maudit-cli"
33+description = "CLI to operate on maudit projects."
44+version = "0.1.0"
55+license = "MIT"
66+edition = "2021"
77+88+[dependencies]
99+log = { version = "0.4", features = ["kv"] }
1010+env_logger = "0.11.5"
1111+chrono = "0.4.39"
1212+colored = "2.2.0"
1313+clap = { version = "4.5.23", features = ["derive"] }
+32
crates/cli/src/main.rs
···11+use clap::{Parser, Subcommand};
22+33+#[derive(Parser)]
44+#[command(author, version, about, long_about = None)]
55+#[command(propagate_version = true)]
66+struct Cli {
77+ #[command(subcommand)]
88+ command: Commands,
99+}
1010+1111+#[derive(Subcommand)]
1212+enum Commands {
1313+ /// Build the project
1414+ Build,
1515+ /// Run the project in development mode
1616+ Dev,
1717+}
1818+1919+fn main() {
2020+ let cli = Cli::parse();
2121+2222+ // You can check for the existence of subcommands, and if found use their
2323+ // matches just as you would the top level cmd
2424+ match &cli.command {
2525+ Commands::Build {} => {
2626+ println!("Building...");
2727+ }
2828+ Commands::Dev {} => {
2929+ println!("Running in development mode...");
3030+ }
3131+ }
3232+}