From 3980cc7c38f043c53c9811078101d7a78de3f8d1 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 29 Jan 2026 22:03:10 +0100 Subject: words: allow the creation of irregular words MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- crates/cli/src/words.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'crates/cli/src') diff --git a/crates/cli/src/words.rs b/crates/cli/src/words.rs index 953760a..cd0f1a0 100644 --- a/crates/cli/src/words.rs +++ b/crates/cli/src/words.rs @@ -250,6 +250,7 @@ fn prompt_conjugation(conjugation: Conjugation) -> Result { Conjugation::Third, Conjugation::ThirdIo, Conjugation::Fourth, + Conjugation::Other, ]; let idx = conjugation as usize - 1; @@ -376,7 +377,20 @@ fn ask_for_word_based_on(enunciated: String, word: Word) -> Result Err(_) => return Err("abort!".to_string()), } } - Category::Verb => String::from("verb"), + Category::Verb => { + if matches!(conjugation, Some(Conjugation::Other)) { + let options = vec![ + "sum", "possum", "eo", "volo", "nolo", "malo", "fero", "facio", "do", "inquam", + "aio", + ]; + match Select::new("Kind:", options).prompt() { + Ok(kind) => kind.to_string(), + Err(_) => return Err("abort!".to_string()), + } + } else { + "verb".to_string() + } + } _ => String::from("-"), }; @@ -968,7 +982,9 @@ fn show_info(word: Word) -> Result<(), String> { // Conjugation, declension + kind. match word.conjugation { - Some(ref conjugation) => println!("Conjugation: {}", conjugation), + Some(ref conjugation) => { + println!("Conjugation: {}", conjugation.display_with_kind(&word.kind)) + } None => { if let Some(ref d) = word.declension { if matches!(d, Declension::Other) { -- cgit v1.2.3