use cirious_codex_derive::{CodexCommand, CodexParser, CodexSubcommand};
#[derive(Debug, Clone)]
pub struct GlobalArgs {
pub verbose: bool,
pub config_path: Option<String>,
}
pub trait CodexCommand {
fn global_args(&self) -> &GlobalArgs;
}
#[derive(CodexParser, CodexCommand, Debug)]
pub struct BuildArgs {
pub global: GlobalArgs,
#[codex(aliase = "", command = "build-example", default_value = "app-example")]
pub build_example: String,
}
#[derive(CodexParser, CodexCommand, Debug)]
pub struct RunArgs {
pub global: GlobalArgs,
#[codex(aliase = "", command = "run-example", default_value = "app-example")]
pub run_example: String,
}
#[derive(CodexSubcommand)]
enum MyCLI {
Build(BuildArgs),
Run(RunArgs),
}
fn main() {
let command = MyCLI::parse();
match command {
MyCLI::Build(args) => println!("Construindo com {args:?}"),
MyCLI::Run(args) => println!("Executando com {args:?}"),
}
}