use xarp::{Arg, ArgAction, Xarp};
fn main() {
let app = Xarp::new("mycli")
.version("0.1.2")
.about("A lightning-fast, styled CLI tool built with xarp")
.arg(
Arg::new("input")
.help("The input file to process")
.value_name("FILE")
.required(true),
)
.arg(
Arg::new("verbose")
.short('v')
.long("verbose")
.help("Enable verbose debugging output")
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("output")
.short('o')
.long("output")
.help("Target path for generated output")
.value_name("PATH")
.default_value("dist/output.bin"),
)
.subcommand(
Xarp::new("build")
.about("Compile source packages into binary distributions")
.arg(
Arg::new("release")
.long("release")
.help("Compile artifacts in release mode with optimizations")
.action(ArgAction::SetTrue),
),
);
let matches = app.get_matches();
if let Some(("build", sub_matches)) = matches.subcommand() {
let is_release = sub_matches.get_flag("release");
println!("==> Subcommand: build");
println!(" Optimized release build: {is_release}");
return;
}
let input: String = matches
.get_one("input")
.expect("Argument 'input' is required");
let output: String = matches
.get_one("output")
.expect("Argument 'output' has a default value");
let is_verbose: bool = matches.get_flag("verbose");
println!("Configuration loaded:");
println!(" - Input: {input}");
println!(" - Output: {output}");
println!(" - Verbose: {is_verbose}");
}