feat: add __args
This commit is contained in:
22
__args/argh-test/src/main.rs
Normal file
22
__args/argh-test/src/main.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use argh::FromArgs;
|
||||
|
||||
#[derive(Debug, FromArgs)]
|
||||
/// Reach new heights.
|
||||
struct GoUp {
|
||||
/// whether or not to jump
|
||||
#[argh(switch, short = 'j')]
|
||||
jump: bool,
|
||||
|
||||
/// how high to go
|
||||
#[argh(option)]
|
||||
height: usize,
|
||||
|
||||
/// an optional nickname for the pilot
|
||||
#[argh(option)]
|
||||
pilot_nickname: Option<String>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let up: GoUp = argh::from_env();
|
||||
println!("{:#?}", up);
|
||||
}
|
||||
Reference in New Issue
Block a user