Skip to content

Latest commit

 

History

History
129 lines (84 loc) · 4.17 KB

README-en.md

File metadata and controls

129 lines (84 loc) · 4.17 KB

dioxionary

dependency status Build Status

简体中文 | English

Look up and memorize all words in terminal offline / online!

Prerequisites

  • sqlite3
  • openssl

Installation

Download Prebuilt Binaries

It is recommended to download the prebuilt binary file for your platform from the Github Release on the right side.

Alternatively, you can also download the latest build binaries, including Linux and Windows versions, from the GitHub Actions.

Compile from source

cargo install dioxionary

Usage

demo

Enable argument completion

$ eval "$(dioxionary -c bash)" # for bash
$ eval "$(dioxionary -c zsh)"  # for zsh
$ eval "$(dioxionary -c fish)" # for fish

You can write the above commands directly into the configuration file of your shell.

Look up word meaning

$ dioxionary lookup [OPTIONS] [WORD]

The subcommand lookup can be omitted:

$ dioxionary [OPTIONS] [WORD]

When there is no word to be searched in the parameter, it will enter the interactive mode, and can search infinitely until Ctrl+D is pressed.

Supports and uses fuzzy search by default. When no word is found in the dictionary, it will output the most similar definition of one or more words.

Use -e or --exact-search to turn off fuzzy search. You can also turn fuzzy search on or off by prefixing a word with / or |, and use web dictionaries with @ before a word.

$ dioxionary /terraria   # Fuzzy search
$ dioxionary '|terraria' # Non-fuzzy search, pay attention to use quotation marks
$ dioxionary @terraria   # Online search

The local dictionary is used by default, and the local dictionary directory should be stored in:

Platform Value Example
Linux $XDG_CONFIG_HOME/dioxionary or $HOME/.config/dioxionary /home/alice/.config/dioxionary
macOS $HOME/Library/Application Support/dioxionary /Users/Alice/Library/Application Support/dioxionary
Windows {FOLDERID_RoamingAppData}/dioxionary C:\Users\Alice\AppData\Roaming/dioxionary

Only stardict dictionary format is supported

You can download dictionaries in stardict format at http://download.huzheng.org/

~/.config/dioxionary
├── 00-cdict-gb
├── 01-kdic-computer-gb
├── 02-langdao-ec-gb
├── 03-oxford-gb
└── 04-powerword2011_1_900

    00-cdict-gb
    ├── cdict-gb.dict
    ├── cdict-gb.dict.dz
    ├── cdict-gb.idx
    └── cdict-gb.ifo

Using the -x option will use an online dictionary lookup:

$ dioxionary -x <DICTDIR> <WORD>

The dictionary file path can be specified with the -l or --local option.

Use the -L or --local-first option to use the network dictionary after a local lookup fails. It is recommended to add alias rl='dioxionary -l' in the shell configuration file.

Multiple dictionary support

As in the above example, the dictionary directories can be named in the format of 00-XXX, 01-YYY, ..., 99-ZZZ to achieve priority.

List records

Note: Only the word type will be searched and recorded when searching online

$ dioxionary list [OPTIONS] [TYPE]

The following word types are supported:

CET4 CET6 TOEFL IELTS GMAT GRE SAT

List all records when type is missing.

Statistical data

Count the number of various words that have been queried:

$ dioxionary count