diff --git a/src/main.rs b/src/main.rs index 8fa6c79..5a73661 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,12 +2,28 @@ use clap::Parser; use colored::Colorize; use serde::Deserialize; +static POSSIBLE_PARTS_OF_SPEECH: &[&str] = &[ + "noun", + "verb", + "adjective", + "adverb", + "pronoun", + "preposition", + "conjunction", + "interjection", + "exclamation", + "determiner", + "article", +]; + #[derive(Parser, Debug)] #[command(version, about, long_about = None)] struct Args { word: String, #[arg(short, long, default_value = "en")] language: String, + #[arg(short, long, default_values = POSSIBLE_PARTS_OF_SPEECH)] + parts_of_speech: Vec, #[arg(short, long, action = clap::ArgAction::SetTrue)] examples: bool, } @@ -52,6 +68,9 @@ async fn main() { let result = result.unwrap(); for entry in result.entries { + if !args.parts_of_speech.contains(&entry.part_of_speech) { + continue; + } println!( "{} ({})", result.word.yellow().underline(),