CLI Reference
The emtrans command translates English to Monsu (and back) with a dictionary.
It is the console-script entry point declared in
pyproject.toml
as emtrans = "emtranslator.cli:main".
Global options
usage: emtrans [-h] [--version] {translate,add,list} ...
-h,--help— show help and exit.--version— show the program version (emtrans 0.1.0) and exit.
If the first argument is not translate, add, or list, translate is
assumed. That means emtrans "hello" and emtrans translate "hello" are
equivalent.
Subcommands
translate
Translate text, a file, or stdin.
usage: emtrans translate [-h] [-i FILE] [-o FILE] [-r] [-d FILE] [--json]
[text ...]
| Option | Description |
|---|---|
text ... |
Text to translate. Omit to read from stdin. |
-i FILE, --input FILE |
Read input from FILE. Cannot be combined with a text argument. |
-o FILE, --output FILE |
Write the translation to FILE instead of stdout. |
-r, --reverse |
Translate from Monsu to English. |
-d FILE, --dictionary FILE |
Extra TOML dictionary to merge in. |
--json |
Output original, translated, missing, and reverse as JSON. |
Examples:
emtrans "Hello world"
emtrans --reverse "monsu_1 monsu_2"
emtrans translate -i input.txt -o output.txt
emtrans --json "hello zebra"
add
Add an English-to-Monsu mapping.
usage: emtrans add [-h] [-d FILE] english monsu
| Option | Description |
|---|---|
english |
The English word. Lower-cased before saving. |
monsu |
The Monsu word. |
-d FILE, --dictionary FILE |
Write to FILE instead of the user dictionary. |
Without -d, the word is written to the user dictionary at
~/.config/neostore/emtranslator/config.toml. The command prints
Added <english> -> <monsu> on success.
emtrans add hi monsu_91
emtrans add hola monsu_92 -d ./project-dict.toml
list
List the active dictionary.
usage: emtrans list [-h] [-d FILE] [--json]
| Option | Description |
|---|---|
-d FILE, --dictionary FILE |
List only the mappings in FILE. |
--json |
Output the dictionary as sorted JSON. |
Without -d, the output is the built-in dictionary merged with the user
dictionary (user words win).
emtrans list
emtrans list --json
emtrans list -d ./project-dict.toml
Exit codes
0— success.2— usage error (unknown options, missing required arguments, conflictingtextand--input, emptyenglish/monsu, or I/O errors). The error message is written to stderr asemtrans: error: ....
See also
- Usage for end-to-end examples.
- Configuration for the dictionary file format.