diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-01-29 22:03:10 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-01-29 22:03:10 +0100 |
| commit | 3980cc7c38f043c53c9811078101d7a78de3f8d1 (patch) | |
| tree | 1521b6bf83d3411e3f725fc8b7b496de94cc061f /crates | |
| parent | a9946caa0df69c7799e5909272968337453360e4 (diff) | |
| download | mihi-3980cc7c38f043c53c9811078101d7a78de3f8d1.tar.gz mihi-3980cc7c38f043c53c9811078101d7a78de3f8d1.zip | |
words: allow the creation of irregular words
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/cli/src/words.rs | 20 |
1 files changed, 18 insertions, 2 deletions
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, String> { 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<Word, String> 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) { |
