clap/clap_derive/examples/from_crate.rs

16 lines
433 B
Rust
Raw Normal View History

//! How to derive the author, description, and version from Cargo.toml
2020-02-05 11:12:39 +00:00
use clap::Parser;
2020-02-05 11:12:39 +00:00
#[derive(Parser, Debug)]
2020-02-05 11:12:39 +00:00
#[clap(author, about, version)]
// ^^^^^^ <- derive author from Cargo.toml
// ^^^^^ <- derive description from Cargo.toml
// ^^^^^^^ <- derive version from Cargo.toml
struct Opt {}
fn main() {
let opt = Opt::parse();
println!("{:?}", opt);
}