Skip to content

chenjiandongx/youdao-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang 有道词典命令行版 License: MIT

Golang 编写的有道词典命令行版本,支持单词或句子中英互译。Python 版

一直觉得 Python 写一些命令行脚本还算方便,直到我知道了 go build....

构建

获取源码

$ git clone https://github.com/chenjiandongx/youdao-go.git

编译

  • Windows
$ go get
$ go build -ldflags "-s -w" -o yd.exe cli.go core.go
  • Linux/MacOS
$ go get
$ go build -ldflags "-s -w" -o yd cli.go core.go

upx 压缩可执行文件

$ upx yd    # windows 则为 upx yd.exe

使用

$ yd --help
yd <words> [options]

Query words meanings via the command line.

Example:
  words could be word or sentence.

  yd hello
  yd php is the best language in the world
  yd 你好

Usage:
  yd <words>...
  yd -h | --help
  yd -v | --version

Options:
  -h --help         show this help message and exit.
  -v  --version     displays the current version of youdao-go.

查询单词

$ yd coder
>>  coder: 编码器

    美:['kəudə]  英:['kəʊdə]

    n. 编码器;编码员
    n. (Coder)人名;(法)科代;(英、葡)科德尔

    coder[编码员 编码器 程序员]
    speech coder[语言编码器 音频编码器 语音编码器]
    incremental coder[增量编码器]

查询句子

$ yd talk is cheap, show me the code
>>  talk is cheap, show me the code: 说说很简单,给我代码

中文翻译

$ yd php是世界上最好的语言
>>  php是世界上最好的语言: PHP is one of the best language in the world

LICENSE

MIT ©chenjiandongx

About

📘 Golang 有道词典命令行版

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published