| 1 | use clap::Parser; |
|---|---|
| 2 | |
| 3 | #[derive(Parser)] // requires `derive` feature |
| 4 | #[command(name = "cargo")] |
| 5 | #[command(bin_name = "cargo")] |
| 6 | enum CargoCli { |
| 7 | ExampleDerive(ExampleDeriveArgs), |
| 8 | } |
| 9 | |
| 10 | #[derive(clap::Args)] |
| 11 | #[command(author, version, about, long_about = None)] |
| 12 | struct ExampleDeriveArgs { |
| 13 | #[arg(long)] |
| 14 | manifest_path: Option<std::path::PathBuf>, |
| 15 | } |
| 16 | |
| 17 | fn main() { |
| 18 | let CargoCli::ExampleDerive(args) = CargoCli::parse(); |
| 19 | println!("{:?}", args.manifest_path); |
| 20 | } |
| 21 |
