项目作者: woorui

项目描述 :
Simple but feature-complete command-line dictionary
高级语言: Go
项目地址: git://github.com/woorui/dict.git
创建时间: 2019-04-03T13:35:07Z
项目社区:https://github.com/woorui/dict

开源协议:

下载


A simple but feature-complete command-line dictionary

English | 简体中文

1. Install golang

debain

  1. sudo apt-get install golang-go

macos

  1. brew update && brew upgrade && brew install go

2. Setting the environment variable

Bash

Edit your ~/.bash_profile to add the following line:

  1. export GOPATH=$HOME/go
  2. export PATH=$PATH:$GOPATH/bin

Save and exit your editor. Then, source your ~/.bash_profile.

  1. source ~/.bash_profile

Zsh

Edit your ~/.zshrc file to add the following line:

  1. export GOPATH=$HOME/go
  2. export PATH=$PATH:$GOPATH/bin

Save and exit your editor. Then, source your ~/.zshrc.

  1. source ~/.zshrc

3. Install the dict

  1. go get -u github.com/woorui/dict

4. Apply appid and secret from baidu and youdao open api

baidu

http://api.fanyi.baidu.com/api/trans/product/index

youdao

https://ai.youdao.com

5. Write your config

  1. -
  2. key: baidu
  3. value: YOUR_BAIDU_APPID-YOUR_BAIDU_SECRET
  4. -
  5. key: youdao
  6. value: YOUR_YOUDAO_APPKEY-YOUR_YOUDAO_ADDSECRET

note. key is api source, value is strings.Join([]string{APPID, SECRET}, "-"})

If you want both, add two key-value, If you want one of them, add key-value you want.

6. Running the dict and specify the config file

  1. dict -file TYPING_YOUR_CONFIG_FILE_WHEN_FIRST_USING

7.Show running results

  1. > hello
  2. 来源 原文 译文 音标 详情
  3. 百度 hello 你好
  4. 有道 hello 你好 həˈləʊ int. 喂;哈罗,你好,您好, n. 表示问候,
  5. 惊奇或唤起注意时的用语, n. (Hello) 人名;(法)埃洛
  6. > 你好
  7. 来源 原文 译文 音标 详情
  8. 百度 你好 Hello
  9. 有道 你好 hello hello, hi, how do you do