Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cqb13 committed Feb 27, 2024
1 parent 3c3384a commit 0188cd0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 13 deletions.
45 changes: 34 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ` `<MAX_ENTRIES>`: 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 <MAX_ENTRIES>` or `--max-entries <MAX_ENTRIES>`: The maximum number of entries to return (default: 6)
- `-m` or `--max ` `<MAX_ENTRIES>`: 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` `<part Of Speech List>`: 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` `<MAX_WORD_LEN>`: The maximum length of words to return
- `-n` or `--min` `<MIN_WORD_LEN>`: The minimum length of words to return
- `-e` or `--exact` `<EXACT>`: Only return words that match the exact length
- `-a` or `--amount` `<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` `<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"
```
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)
Expand All @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/use_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 0188cd0

Please sign in to comment.