Skip to content

Commit

Permalink
read arguments from command line for num_words and num_peek
Browse files Browse the repository at this point in the history
  • Loading branch information
SebRollen committed May 19, 2022
1 parent 4b9091f commit 1692fa8
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 1 deletion.
137 changes: 137 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ categories = ["command-line-utilities", "games"]
[dependencies]
itertools = "0.10.3"
rand = "0.8.5"
structopt = { version = "0.3.26", default-features = false }
termion = "1.5.6"
12 changes: 11 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
use structopt::StructOpt;
use typycal::Game;

#[derive(Debug, StructOpt)]
struct App {
#[structopt(default_value = "10")]
words: usize,
#[structopt(short, long, default_value = "3")]
num_peek: u16,
}

fn main() -> std::io::Result<()> {
let game = Game::words(10).num_peek(3);
let app = App::from_args();
let game = Game::words(app.words).num_peek(app.num_peek);
game.play()
}

0 comments on commit 1692fa8

Please sign in to comment.