Allow passing args to , watch
This commit is contained in:
parent
1ff8e396cb
commit
9f448de544
2 changed files with 24 additions and 3 deletions
|
@ -83,7 +83,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
watch = {
|
watch = {
|
||||||
exec = ''cargo watch -x run'';
|
exec = ''
|
||||||
|
set -x
|
||||||
|
cargo watch -x "run -- $*"
|
||||||
|
'';
|
||||||
description = "Watch for changes and run the project executable";
|
description = "Watch for changes and run the project executable";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
22
src/main.rs
22
src/main.rs
|
@ -1,3 +1,21 @@
|
||||||
fn main() {
|
use argh::FromArgs;
|
||||||
println!("Hello World!");
|
|
||||||
|
#[derive(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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue