keenwon / eazydict Goto Github PK
View Code? Open in Web Editor NEW简单易用的命令行词典 :closed_book: :orange_book: :green_book: :blue_book: :notebook:
License: MIT License
简单易用的命令行词典 :closed_book: :orange_book: :green_book: :blue_book: :notebook:
License: MIT License
在bin/cli里面的如下代码加一句console.log(argus);
, 如果直接用node bin/cli fly in sky
来查词会报错.
/**
* 主程序
*/
program
.usage('<words...>')
.description('简单易用的命令行词典 https://github.com/keenwon/eazydict')
.option('-s, --save', '查询单词,同时保存到生词本')
.option('-r, --raw', '不转换为小写,查询原始的输入值')
.action(function (...argus) {
// 在这里加一句打印argus
console.log(argus);
const words = argus.slice(0, -1);
const options = {
save: program.save || false,
raw: program.raw || false
};
lookup(words, options);
});
直接用node bin/cli fly in sky
来查词, 输出的argus如下:
[
Command {
_events: [Object: null prototype] {
'option:save': [Function],
'option:raw': [Function],
'--help': [Function]
},
_eventsCount: 3,
_maxListeners: undefined,
commands: [
[Command],
[Command],
[Command],
[Command],
[Command],
[Command],
[Command]
],
options: [ [Option], [Option] ],
parent: null,
_allowUnknownOption: false,
_args: [],
rawArgs: [
'C:\\Users\\jin7\\scoop\\apps\\nodejs-lts\\current\\node.exe',
'C:\\development\\jsdev\\eazydict-origin\\bin\\cli',
'fly',
'in',
'sky'
],
_scriptPath: 'C:\\development\\jsdev\\eazydict-origin\\bin\\cli',
_name: 'cli',
_optionValues: {},
_storeOptionsAsProperties: true,
_storeOptionsAsPropertiesCalled: false,
_passCommandToAction: true,
_actionResults: [],
_actionHandler: [Function: listener],
_executableHandler: false,
_executableFile: null,
_defaultCommandName: null,
_exitCallback: null,
_aliases: [],
_combineFlagAndOptionalValue: true,
_hidden: false,
_hasHelpOption: true,
_helpFlags: '-h, --help',
_helpDescription: 'display help for command',
_helpShortFlag: '-h',
_helpLongFlag: '--help',
_hasImplicitHelpCommand: false,
_helpCommandName: 'help',
_helpCommandnameAndArgs: 'help [command]',
_helpCommandDescription: 'display help for command',
program: [Circular],
Command: [class Command extends EventEmitter],
Option: [class Option],
CommanderError: [class CommanderError extends Error],
_usage: '<words...>',
_description: '简单易用的命令行词典 https://github.com/keenwon/eazydict',
_argsDescription: undefined,
args: [ 'fly', 'in', 'sky' ],
[Symbol(kCapture)]: false
},
[ 'fly', 'in', 'sky' ]
]
通过npm install -g eazydict
安装的, 用eazydict fly in sky
来查词, 输出的argus如下:
[
'fly',
'in',
'sky',
Command {
commands: [
[Command],
[Command],
[Command],
[Command],
[Command],
[Command],
[Command]
],
options: [ [Option], [Option] ],
_execs: {},
_allowUnknownOption: false,
_args: [],
_name: 'cli',
Command: [Function: Command],
Option: [Function: Option],
_usage: '<words...>',
_description: '简单易用的命令行词典 https://github.com/keenwon/eazydict',
_argsDescription: undefined,
_events: [Object: null prototype] {
'option:save': [Function],
'option:raw': [Function],
'command:*': [Function: listener],
'command:lookup': [Function: listener],
'command:l': [Function: listener],
'command:version': [Function: listener],
'command:v': [Function: listener],
'command:history': [Function: listener],
'command:h': [Function: listener],
'command:save': [Function: listener],
'command:s': [Function: listener],
'command:install': [Function: listener],
'command:i': [Function: listener],
'command:wordbook': [Function: listener],
'command:w': [Function: listener],
'command:status': [Function: listener],
'--help': [Function]
},
_eventsCount: 17,
rawArgs: [
'C:\\Users\\jin7\\scoop\\apps\\nodejs-lts\\current\\node.exe',
'C:\\Users\\jin7\\scoop\\apps\\nodejs-lts\\current\\bin\\node_modules\\eazydict\\bin\\cli',
'fly',
'in',
'sky'
],
args: [ 'fly', 'in', 'sky', [Circular] ]
}
]
百思不得其解, 不知道为什么会这样? 直接在项目文件夹里面用node bin/cli fly in sky
来查词, 输出argus和全局安装的不同.
我看了commander的文档, 也不知道为何.
原谅我是菜鸟, 愿意打赏一下大佬.
❯ eazydict --help
/usr/lib/node_modules/eazydict/node_modules/global-npm/index.js:37
throw e
^
Error: The programmatic API was removed in npm v8.0.0
at Object.<anonymous> (/usr/lib/node_modules/npm/index.js:4:9)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
at Module.load (node:internal/modules/cjs/loader:1068:32)
at Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1092:19)
at require (node:internal/modules/cjs/helpers:103:18)
at /usr/lib/node_modules/eazydict/node_modules/global-npm/index.js:29:15
at Object.<anonymous> (/usr/lib/node_modules/eazydict/node_modules/global-npm/index.js:41:3)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
at Module.load (node:internal/modules/cjs/loader:1068:32)
at Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1092:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/usr/lib/node_modules/eazydict/node_modules/npmi/npmi.js:1:14)
at Module._compile (node:internal/modules/cjs/loader:1205:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1259:10)
at Module.load (node:internal/modules/cjs/loader:1068:32)
at Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1092:19)
at require (node:internal/modules/cjs/helpers:103:18)
Node.js v19.1.0
BTW, can it translate sentence?
没有功能上的问题,每次运行这个程序会出现以下提示(需要更换一个包):
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators .nvm/versions/node/v6.11.4/lib/node_modules/eazydict/node_modules/sequelize/lib/sequelize.js:236:13
能不能增加一个功能: 在使用eazydict的时候用参数选择从哪个词典查询数据。
比方说我为了网络相应快,一般选择使用有道。但是有些时候个别词查不到,我又想选择google。期望能够提供一中如下结构的调用方式
eazydict -p youdao robot
# 甚至是这样:
eazydict -p y robot # youdao
eazydict -p b robot # bing
eazydict -p g robot # google
that's all.
PS
谢谢你提供的工具
非常棒
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.