Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ding-trans

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ding-trans - npm Package Compare versions

Comparing version 1.0.35 to 1.0.36

28

bin/translate.js
#! /usr/bin/env node
//业务逻辑
//1.turnout命令+中英文[args,--read,-r]
//1.ding命令+中英文[args,--say,-S]
//捕获参数,使用yargs.argv对象;

@@ -16,7 +16,20 @@ //2.将捕获到的用户的输入参数传入有道云api的q(key)中,使用字符串拼接;

let argv = require("yargs").argv,
queryStr = encodeURI(argv._.join(" ")),
read = argv.r || argv.read;
if (!queryStr) {
queryStr = encodeURI(argv._.join(" "));
// read = argv.r || argv.read;
// console.log(argv);
// 无参数,或帮助
if (!queryStr || argv.help == true || argv.H == true || argv.h == true) {
console.log("-------------------------------");
console.log("查单词: ".bold.blue);
console.log("ding [单词] 或者 [短句]", "\n");
console.log("汉译英: ".bold.red);
console.log("ding [文本]", "\n");
console.log("单词/短句发音: ".bold.yellow);
console.log("ding [单词] [短句] --say");
console.log("ding [单词] [短句] -S");
console.log("-------------------------------");
console.log("请在'ding'命令后输入单词或断句!");
console.log("word or sentence required...");
} else {
//播放
if (argv.say == true || argv.S == true) {

@@ -27,7 +40,6 @@ console.log("播放中...".green);

}
//查词
sendInfo(queryStr);
}
if (read) {
console.log("waiting for the new function...");
}
//格式化
function format(json) {

@@ -77,3 +89,3 @@ let data = JSON.parse(json),

}
//发送请求
function sendInfo(query) {

@@ -80,0 +92,0 @@ //发送翻译请求

{
"name": "ding-trans",
"version": "1.0.35",
"version": "1.0.36",
"description": "a translation cli",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc