Ydict, 专为命令行极客打造的有道词典!

Ydict, 专为命令行极客打造的有道词典!

Go 命令行/控制台

访问GitHub主页

共301Star

详细介绍

██╗   ██╗██████╗ ██╗ ██████╗████████╗
╚██╗ ██╔╝██╔══██╗██║██╔════╝╚══██╔══╝
 ╚████╔╝ ██║  ██║██║██║        ██║   
  ╚██╔╝  ██║  ██║██║██║        ██║   
   ██║   ██████╔╝██║╚██████╗   ██║   
   ╚═╝   ╚═════╝ ╚═╝ ╚═════╝   ╚═╝   

Release MIT licensed Build Status Go Report Card

Ydict, another command-line youdao dictionary for geeks!

(中文介绍文档)

Features

  • Chinese -> English
  • English -> Chinese
  • Show hints if word is not found
  • Speech
  • Show example sentences
  • Vim support

Installation

Homebrew

brew tap timothyye/tap
brew install timothyye/tap/ydict

Using Go

go get github.com/TimothyYe/ydict

Manual Installation

Download it from releases, and extact it to /usr/bin.

Integrate with Vim

To query words from Vim, you need another Vim plugin: vim-ydict

Speech

Starting from V0.9, speech feature is available. You need to install mpg123 to enable this feature.

NOTICE: Currently, speech feature is only available for MacOS/Linux.

Mac OS

brew install mpg123

Ubuntu

sudo apt-get install mpg123

CentOS

yum install -y mpg123

Usage

ydict [flags]

Flags:
  -c, --cache       Query with local cache, and save the query word(s) into the cache.
  -d, --delete      Remove word(s) from the cache.
  -h, --help        help for ydict
  -l, --list        List all the words from the local cache.
  -m, --more        Query with more example sentences.
  -p, --play int    Scan and display all the words in local cache.
  -q, --quiet       Query with quiet mode, don't show spinner.
  -r, --reset       Clear all the words from the local cache.
  -s, --sentence    Translation of sentences.
  -v, --voice int   Query with voice speech, the default voice play count is 0.
  1. Query
ydict <word(s) to query>
  1. Query with speech (Available for MacOS & Linux)
ydict -v 1 <word(s) to query>
  1. Query and show more example sentences
ydict -m <word(s) to query>
  1. Query and add this word into local cache, next time when you query the same word, it will be feched from the local cache and be much more faster.
ydict -c <word(s) to query>
  1. Query sentence
ydict -s "你觉得咋样?"

## SOCKS5 proxy

Starting from V0.5, you can use SOCKS5 proxy. At the same directory of ydict, just create a ```.env``` file:

```text
SOCKS5=127.0.0.1:7070

Now all the queries will go through the specified SOCKS5 proxy.

New words notebook

Starting from ydict V2.0, new words notebook is supported. You can use is to add/delete your new words and play it.

  • Add a new word to the notebook
ydict -c hello
  • Remove a word from the notebook
ydict -d hello
  • List all the words from the notebook
ydict -l
  • Display a random word from the notebook for every 10 seconds
ydict -p 10

Help

Just type "ydict" to get help.

Licence

MIT License