A shell dictionary created by Rust.
Just download the binary file and put it into a directory which has been add to path
.
- Visit rust-lang.org and select a suitable way to install Rust.
- Clone this repo and run
cargo build [--release]
.
Ensure you have add environmental variables listed in .env, and runslate can find .env file:
- Current directory.
- Executable file's directory.
- Application directory (~/.runslate/, usually).
# unix
source .env
- The best way to use
runslate
is put it into a dir contained byenv path
and rename it into a shorter name so you can lookup words more conveniently. And more, put.env
into that dir, too. - Type
runslate -h
for usage details, here are some options for example:-t, --translator
to select translator(API provider).-s, --source-lang
to set source language.-d, --target-lang
to set target language.-v, --verbose
show debug logs.- ...
runslate
provides someenv-vars
for configuration, in.env
:- Use
RUNSLATE_TRANSLATOR
to pick translator. Available values: [youdao
,google
]. - Check env template file
.env
for more envs.
- Use
- How does
env
work?- First, runslate will try to read
.env
in current directory, executable file directory, app directory(~/.runslate
) one by one. If env file loading fails, program would exit. - Second, parse options:
- Some options are related to specified
env-vars
, if they were found, use them first. - Use options' default values(if given).
- If there is not
env-var
neither default value, an error is reported.
- Some options are related to specified
- As for some circumstances like env conflicting, not tested yet.
- First, runslate will try to read
- clap: parse arguments.
- reqwest: http request.
- serde_json: json parse.
- env_logger: logging.
- dotenv: load env.
- 2024-03-17 v0.4.4 It won't panic if .env file doesn't exist.
- 2023-08-15 v0.3.0 Load
.env
file from current dir, app-dir(~/.config/runslate/), exe-file dir one by one. - 2023-08-15 v0.2.0 Save & load cache.
- v0.1.0 Main function released which contains Youdao and google api.