aboutsummaryrefslogtreecommitdiff
path: root/crates/cli/src
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-01-29 22:03:10 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-01-29 22:03:10 +0100
commit3980cc7c38f043c53c9811078101d7a78de3f8d1 (patch)
tree1521b6bf83d3411e3f725fc8b7b496de94cc061f /crates/cli/src
parenta9946caa0df69c7799e5909272968337453360e4 (diff)
downloadmihi-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/cli/src')
-rw-r--r--crates/cli/src/words.rs20
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) {