Actually use the clap dependency
This commit is contained in:
parent
50be0563c3
commit
8ae61871a3
2 changed files with 16 additions and 6 deletions
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
@ -14,4 +14,5 @@ jobs:
|
|||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
- run: nix develop -c rustc --version
|
||||
- run: nix run . -- ping
|
||||
- run: nix-build
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
use std::fmt::{Display, Formatter};
|
||||
use clap::{App, SubCommand};
|
||||
|
||||
|
||||
enum VertDir {
|
||||
Up,
|
||||
|
@ -107,6 +109,12 @@ impl Display for Game {
|
|||
}
|
||||
|
||||
fn main () {
|
||||
let matches = App::new("bouncy")
|
||||
.version("1.0")
|
||||
.subcommand(SubCommand::with_name("ping")).get_matches();
|
||||
if let Some(_matches) = matches.subcommand_matches("ping") {
|
||||
println!("pong")
|
||||
} else {
|
||||
let mut game = Game::new();
|
||||
let sleep_duration = std::time::Duration::from_millis(33);
|
||||
loop {
|
||||
|
@ -114,4 +122,5 @@ fn main () {
|
|||
game.step();
|
||||
std::thread::sleep(sleep_duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue