diff options
Diffstat (limited to 'CLI/rust/src/game_of_life.rs')
| -rw-r--r-- | CLI/rust/src/game_of_life.rs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/CLI/rust/src/game_of_life.rs b/CLI/rust/src/game_of_life.rs new file mode 100644 index 0000000..fffaa42 --- /dev/null +++ b/CLI/rust/src/game_of_life.rs @@ -0,0 +1,69 @@ +use clap::{crate_authors, crate_version, App, Arg, ArgMatches, Error}; + +/// Define the Clap CLI for running Game of Life simulation +/// +/// Using Clap to define the available options that can be used with game of life +pub(crate) fn options() -> Result<ArgMatches, Error> { + let matches = App::new("Game of Life") + .author(crate_authors!()) + .version(crate_version!()) + .arg( + Arg::new("seed") + .about("Specify the seed number to use as an initial state [default: random]") + .takes_value(true) + .long("seed") + .short('s') + .conflicts_with("input") + .display_order(0) + ) + .arg( + Arg::new("input") + .about("Specify the path/URL for the file to use as an initial state. (used instead of seed)") + .takes_value(true) + .long("input") + .short('i') + .display_order(1) + ) + .arg( + Arg::new("width") + .about("Specify the width of generated universe. [default: terminal width]") + .takes_value(true) + .long("width") + .display_order(2) + ) + .arg( + Arg::new("height") + .about("Specify the width of generated universe. [default: terminal height]") + .takes_value(true) + .long("height") + .display_order(3) + ) + .arg( + Arg::new("live-cell") + .about("Specify the live-cell representation") + .takes_value(true) + .long("live-cell") + .default_value("█") + .display_order(4) + ) + .arg( + Arg::new("dead-cell") + .about("Specify the dead-cell representation") + .takes_value(true) + .long("dead-cell") + .default_value(" ") + .display_order(5) + ) + .arg( + Arg::new("delay") + .about("Specify the introduced delay between each generation") + .takes_value(true) + .short('d') + .long("delay") + .default_value("50") + .display_order(6) + ) + .get_matches(); + + Ok(matches) +} |
