summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora14m <[email protected]>2021-04-07 11:27:15 +0200
committera14m <[email protected]>2021-04-07 11:27:15 +0200
commit61c49255eba642ee342aee5f7b02a57eec2cd84f (patch)
treec77cfcebc32b19bc43277ee588e41cfcc3e34a6e
parent5dcd0cf4dfd783c6f35591a53cda68434e417981 (diff)
Use opts instead of full paths
-rw-r--r--CLI/rust/src/game_of_life.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/CLI/rust/src/game_of_life.rs b/CLI/rust/src/game_of_life.rs
index fd147c5..6b52034 100644
--- a/CLI/rust/src/game_of_life.rs
+++ b/CLI/rust/src/game_of_life.rs
@@ -4,6 +4,7 @@ use clap::{crate_authors, crate_version, App, Arg, Error};
/// Options module for validations and Opts struct
pub(crate) mod opts;
+use opts::{validators, Opts};
/// Generators Module to provide interface for generating universes
/// using Seed or File input
@@ -42,7 +43,7 @@ pub(crate) fn app() -> App<'static> {
.about("Specify the width of generated universe. [default: terminal width]")
.takes_value(true)
.long("width")
- .validator(opts::validators::is_fitting_term_width)
+ .validator(validators::is_fitting_term_width)
.display_order(2)
)
.arg(
@@ -50,7 +51,7 @@ pub(crate) fn app() -> App<'static> {
.about("Specify the width of generated universe. [default: terminal height]")
.takes_value(true)
.long("height")
- .validator(opts::validators::is_fitting_term_height)
+ .validator(validators::is_fitting_term_height)
.display_order(3)
)
.arg(
@@ -76,7 +77,7 @@ pub(crate) fn app() -> App<'static> {
.short('d')
.long("delay")
.default_value("50")
- .validator(opts::validators::is_positive)
+ .validator(validators::is_positive)
.display_order(6)
)
}
@@ -163,7 +164,7 @@ mod app {
///
/// If an input is provided, the input will be used (taking precedence over seed)
/// Else use the seed option (defaults to random when not provided).
-pub(crate) fn generate(opts: opts::Opts) -> Result<Universe, Error> {
+pub(crate) fn generate(opts: Opts) -> Result<Universe, Error> {
match opts.input {
Some(_) => generators::input::new(opts),
None => generators::seed::new(opts),
@@ -175,7 +176,7 @@ mod generate {
use super::*;
use mocktopus::mocking::*;
- fn universe_mock(opts: opts::Opts) -> Universe {
+ fn universe_mock(opts: Opts) -> Universe {
Universe {
opts,
current: vec![vec![]],
@@ -185,7 +186,7 @@ mod generate {
#[test]
fn without_input() {
- let opts = opts::Opts {
+ let opts = Opts {
seed: 1337,
input: None,
width: 13,
@@ -203,7 +204,7 @@ mod generate {
#[test]
fn with_input() {
- let opts = opts::Opts {
+ let opts = Opts {
seed: 1337,
input: Some(String::from("input")),
width: 13,