# ecdict
**Repository Path**: traceofpoem/ecdict
## Basic Information
- **Project Name**: ecdict
- **Description**: 📚 ecdict dictionary (Ruby Powered) 命令行端的离线词典ecdict,数据源包含340万单词
- **Primary Language**: Ruby
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-11-08
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
## 介绍
📚 ecdict dictionary (Ruby Powered)
命令行端的离线词典ecdict,数据源包含340万单词,由项目[skywind3000/ECDICT](https://github.com/skywind3000/ECDICT)提供
本项目在Linux上开发,并支持Windows,macOS端未经测试,但应该同Linux上一样。
提供两个命令`ecrepl`和`ecdict`,前者用于交互式查询,后者用于单个单词查询
## 演示

## 安装
仓库仅有 50MB
### 依赖
- Ruby
- SQLite3
插入数据库时间大概为3-4分钟,取决于你的CPU速度
### 自动安装(均已测试)
macOS和Linux用户
```shell
git clone https://gitee.com/ccmywish/ecdict.git ~/.local/share/ecdict && cd ~/.local/share/ecdict \
&& bundle && ruby ./install.rb
```
Windows用户(cmd下执行,而非PowerShell)
```CMD
git clone https://gitee.com/ccmywish/ecdict.git && cd ecdict && bundle && ruby .\install.rb
```
**注意:** Windows用户最后还需要把该目录添加至环境变量
若bundle安装gem sqlite3失败,请翻到最下方查看解决方法
### 手动安装
```CMD
git clone https://gitee.com/ccmywish/ecdict.git
```
- 手动解压 `ecdict-csv.7z` 得到 `ecdict.csv`
- `bundle install` 安装依赖
- `ruby gen_db.rb` 插入数据库信息
- 😃 最后一步
- Windows用户添加该目录至环境变量
- Linux/macOS用户使用 `ln -s $PWD/ecdict.rb /usr/local/bin/ecdict && ln -s $PWD/ecrepl.rb /usr/local/bin/ecrepl`
## 使用
- `ecdict word` 查询单词word
- `ecrepl` 进入交互式查询,输入 exit 或 Ctrl-C 退出
## Troubleshoot
> Windows下 bundle 安装 sqlite3 失败
- 下载安装sqlite源代码 [sqlite-amalgamation-xxxx.zip](https://sqlite.org/download.html) 解压到某文件夹如D:\sqlite-src.
- 在ecdict文件夹下输入`gem install sqlite3 -- --with-sqlite3-lib=D:\sqlite-src`