From 0188cd0b41240234eeeeab40034d6bed3ff3e005 Mon Sep 17 00:00:00 2001 From: cqb13 Date: Tue, 27 Feb 2024 14:13:45 -0500 Subject: [PATCH] updated docs --- README.md | 45 ++++++++++++++++++++++++++++++++++----------- src/main.rs | 2 -- src/use_data/mod.rs | 1 + 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9f2ddd7..9feceab 100644 --- a/README.md +++ b/README.md @@ -50,39 +50,62 @@ $ vocab_vault transEng "English text to translate" ``` - `"English text to translate"`: The English text you want to translate -- Additional global arguments (see below) +- `-m` or `--max ` ``: The maximum number of entries to return (default: 6) +- `-s` or `--sort`: Sort the output by frequency +- `-p` or `--pretty`: Display a pretty version of the output (requires `-f`) +- `-d` or `--detailed`: Add more information to prettified output (requires `-p`) #### `transLat` Command (Translate Latin to English) Translate Latin text to English using the following command: ```bash -$ vocab_vault transLat "Latin text to translate" [-t] +$ vocab_vault transLat "Latin text to translate" ``` - `"Latin text to translate"`: The Latin text you want to translate - `-t` or `--tricks`: Attempt to use various tricks on words for better results -- Additional global arguments (see below) - -### Global Arguments - -These arguments are applicable to both translation commands (`transEng` and `transLat`): - -- `-m ` or `--max-entries `: The maximum number of entries to return (default: 6) +- `-m` or `--max ` ``: The maximum number of entries to return (default: 6) - `-s` or `--sort`: Sort the output by frequency - `-p` or `--pretty`: Display a pretty version of the output (requires `-f`) - `-d` or `--detailed`: Add more information to prettified output (requires `-p`) +#### `getList` Command (Gets a specific list of words from the dictionary) + +Get a specific list of words from the dictionary using the following command: + +```bash +$ vocab_vault getList "word_type" +``` + +- `"word_type"`: The type of word list you want to get + - english, latin, inflections, not_packons, packons, prefixes, stems, suffixes, tackons, tickons, unique_latin +- `-p` or `--pos` ``: A list of parts of speech to filter by (separated by commas) + - noun, verb, participle, adjective, preposition, pronoun, interjection, numeral, conjunction, adverb, number, supine, packon, tackon, prefix, suffix +- `-m` or `--max` ``: The maximum length of words to return +- `-n` or `--min` ``: The minimum length of words to return +- `-e` or `--exact` ``: Only return words that match the exact length +- `-a` or `--amount` ``: The amount of words to return +- `-r` or `--random`: Picks words from random positions +- `-d` or `--display`: Display the words as json +- `-t` or `--to` ``: Saves the list of words to a json file + ### Example Usage -Translate English to Latin with formatted output and cleaning: +Translate English to Latin with 2 options per translation which are sorted by frequency: ```bash $ vocab_vault transEng "why" -m 2 -s ``` -Translate Latin to English with tricks and detailed, pretty, and formatted output: +Translate Latin to English with tricks and pretty output: ```bash $ vocab_vault transLat "cur" -t -p ``` + +Get a list of Latin words with a specific part of speech and save it to a file: + +```bash +$ vocab_vault getList "latin" -p noun,verb -m 6 -n 3 -t "latin_words.json" +``` diff --git a/src/main.rs b/src/main.rs index 20f4f8e..aaa9281 100644 --- a/src/main.rs +++ b/src/main.rs @@ -116,7 +116,6 @@ fn main() { .with_name("random") .with_short('r') .with_long("random") - .with_value_name("RANDOM") .with_help("Get words from a random position") .requires("amount"), ) @@ -125,7 +124,6 @@ fn main() { .with_name("display") .with_short('d') .with_long("display") - .with_value_name("DISPLAY") .with_help("Will display as json"), ) .with_arg( diff --git a/src/use_data/mod.rs b/src/use_data/mod.rs index 1b5547c..7155495 100644 --- a/src/use_data/mod.rs +++ b/src/use_data/mod.rs @@ -151,6 +151,7 @@ pub fn get_list( println!("{}", serde_json::to_string_pretty(&list).unwrap()); } + // TODO: have a default file name if file is not in path, have add json ending if ending is not json or there is no ending if to.is_some() { let file_path = to.unwrap(); let file = std::fs::File::create(file_path).unwrap();