From 05728cc4351763e23295763e8c2252ef252fa8ed Mon Sep 17 00:00:00 2001 From: Peter Sauer Date: Sun, 15 Feb 2026 21:16:18 +0100 Subject: [PATCH] Add --no-shuffle and --no-limit flags for content control --no-shuffle preserves original word order from language files, useful for frequency-ranked practice or reproducible tests. --no-limit uses the entire word list instead of sampling, ignoring the -w word count. Closes #40 Co-Authored-By: Claude Opus 4.6 --- README.md | 2 ++ src/main.rs | 32 ++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dcf7812..a5e4313 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,8 @@ Options: --sudden-death Enable sudden death mode to restart on first error --case-insensitive Ignore case when comparing typed input --no-backspace Disable backspace/delete during test + --no-shuffle Don't shuffle word order + --no-limit Use entire word list (ignore --words limit) --history Show history of past results --last Show only the last N history entries --history-lang Filter history by language diff --git a/src/main.rs b/src/main.rs index be36784..b474971 100644 --- a/src/main.rs +++ b/src/main.rs @@ -77,6 +77,14 @@ struct Opt { #[arg(long)] no_backspace: bool, + /// Don't shuffle word order + #[arg(long)] + no_shuffle: bool, + + /// Use entire word list (ignore --words limit) + #[arg(long)] + no_limit: bool, + /// Show history of past results #[arg(long)] history: bool, @@ -177,15 +185,23 @@ impl Opt { })? .lines() .collect(); - language.shuffle(&mut rng); + if !self.no_shuffle { + language.shuffle(&mut rng); + } - let mut contents: Vec<_> = language - .into_iter() - .cycle() - .take(self.words.get()) - .map(ToOwned::to_owned) - .collect(); - contents.shuffle(&mut rng); + let mut contents: Vec<_> = if self.no_limit { + language.into_iter().map(ToOwned::to_owned).collect() + } else { + language + .into_iter() + .cycle() + .take(self.words.get()) + .map(ToOwned::to_owned) + .collect() + }; + if !self.no_shuffle { + contents.shuffle(&mut rng); + } Ok(contents) }