2021-12-15 17:33:10 +00:00
|
|
|
use clap::Parser;
|
|
|
|
|
2022-07-19 18:29:31 +00:00
|
|
|
#[derive(Parser)] // requires `derive` feature
|
2022-09-02 20:37:23 +00:00
|
|
|
#[command(name = "cargo")]
|
|
|
|
#[command(bin_name = "cargo")]
|
2023-02-06 16:25:14 +00:00
|
|
|
enum CargoCli {
|
|
|
|
ExampleDerive(ExampleDeriveArgs),
|
2021-12-15 17:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(clap::Args)]
|
2024-01-17 14:06:56 +00:00
|
|
|
#[command(version, about, long_about = None)]
|
2023-02-06 16:25:14 +00:00
|
|
|
struct ExampleDeriveArgs {
|
2022-09-02 20:37:23 +00:00
|
|
|
#[arg(long)]
|
2021-12-15 17:33:10 +00:00
|
|
|
manifest_path: Option<std::path::PathBuf>,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2023-02-06 16:25:14 +00:00
|
|
|
let CargoCli::ExampleDerive(args) = CargoCli::parse();
|
2021-12-15 17:33:10 +00:00
|
|
|
println!("{:?}", args.manifest_path);
|
|
|
|
}
|