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