wind-script-cli
Advanced tools
Sorry, the diff of this file is not supported yet
| # [WindScipt](https://github.com/Slouchwind/WindScript) Package \<name\> | ||
| 这是由 WindScript Package Manager 初始化的项目 |
| const ws = require("wind-script"); | ||
| const project = new ws.WSrun(); | ||
| project | ||
| .setCode(`Str E = This is an error message; | ||
| E==> E;`) | ||
| .run(); |
| const ws = require("wind-script"); | ||
| const project = new ws.WSrun(); | ||
| project | ||
| .setPath(__dirname, "./helloworld.ws") | ||
| .run(); |
+9
-19
@@ -19,12 +19,11 @@ #!/usr/bin/env node | ||
| .option("-d, --debug", "display the debug info", false) | ||
| .option("-g, --get <path>", "display all [argument] File at <path>") | ||
| .action((argument, options) => { | ||
| .action((arg, opts) => { | ||
| //debug | ||
| if (options.debug) { | ||
| console.log("argument: ", argument); | ||
| console.log(options); | ||
| if (opts.debug) { | ||
| console.log("argument: ", arg); | ||
| console.log(opts); | ||
| } | ||
| //none or only debug | ||
| if (argument === undefined && options.get === undefined) { | ||
| if (arg === undefined) { | ||
| const read = readline.createInterface({ | ||
@@ -52,17 +51,8 @@ input: process.stdin, | ||
| else { | ||
| if (argument !== undefined) { | ||
| if (options.get !== undefined) { | ||
| var get = lib.objectToTable(lib.getFileList(options.get, argument)); | ||
| get.forEach((value) => console.log(value)); | ||
| console.log(`\nThere is ${get.length - 1} ${argument.toUpperCase()} File at the path "${path.resolve(options.get)}"`); | ||
| } | ||
| else { | ||
| const wsFile = new ws.WSrun(options.debug); | ||
| wsFile | ||
| .setPath(path.resolve(argument)) | ||
| .run(); | ||
| } | ||
| } | ||
| const wsFile = new ws.WSrun(opts.debug); | ||
| wsFile | ||
| .setPath(path.resolve(arg)) | ||
| .run(); | ||
| } | ||
| }) | ||
| .parse(); |
+1
-1
| { | ||
| "name": "wind-script-cli", | ||
| "version": "0.0.13", | ||
| "version": "0.0.14", | ||
| "description": "WindScript Command Line Tool", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
+18
-9
@@ -13,3 +13,3 @@ #!/usr/bin/env node | ||
| var errText = (command, err) => colorText(`${command.toUpperCase()} ERR: ${err.syscall} error`, "0;91") | ||
| var errText = (command, err) => colorText(`${command.toUpperCase()} ERR: 函数 ${err.syscall} 错误`, "0;91") | ||
@@ -19,3 +19,3 @@ program | ||
| .description("WindScript Package Manager") | ||
| .option("-d --debug", "display the debug info", false) | ||
| .option("-d --debug", "显示debug信息", false) | ||
| .action((opts, cmd) => { | ||
@@ -27,3 +27,3 @@ if (opts.debug) { | ||
| if (opts.help === undefined) { | ||
| console.log(`run "wspm ${cmd.commands[0]._helpShortFlag}"`); | ||
| console.log(`输入"wspm ${cmd.commands[0]._helpShortFlag}"获取帮助`); | ||
| } | ||
@@ -34,4 +34,4 @@ }) | ||
| .command("init <name>") | ||
| .description("Init a new WindScript Package and name as <name>") | ||
| .option("-d --debug", "display the debug info", false) | ||
| .description("以 <name> 作为名字初始化WindScript包") | ||
| .option("-d --debug", "显示debug信息", false) | ||
| .action((arg_name, opts, cmd) => { | ||
@@ -45,3 +45,4 @@ if (opts.debug) { | ||
| if (!(dir.includes(arg_name) && fs.statSync(`./${arg_name}`).isDirectory())) fs.mkdirSync(`./${arg_name}`); | ||
| lib.copyDir(path.resolve(__dirname, "./src/template"), `./${arg_name}`); | ||
| else console.log(`已包含目录 ${arg_name}`); | ||
| lib.copyDir(path.resolve(__dirname, "./init-copy"), `./${arg_name}`); | ||
| fs.readFile(`./${arg_name}/helloworld.ws`, (err, data) => { | ||
@@ -55,2 +56,10 @@ if (err) console.log(errText("init", err)); | ||
| }); | ||
| fs.readFile(`./${arg_name}/README.md`, (err, data) => { | ||
| if (err) console.log(errText("init", err)); | ||
| else { | ||
| fs.writeFile(`./${arg_name}/README.md`, data.toString().replace(/\\<name\\>/g, arg_name), (err) => { | ||
| if (err) console.log(errText("init", err)); | ||
| }); | ||
| } | ||
| }); | ||
| }) | ||
@@ -60,4 +69,4 @@ | ||
| .command("list <extname> [path]") | ||
| .description("List file with <extname> in [path]") | ||
| .option("-d --debug", "display the debug info", false) | ||
| .description("列出 [path] 路径下扩展名为 <extname> 文件") | ||
| .option("-d --debug", "显示debug信息", false) | ||
| .action((arg_ext, arg_path, opts, cmd) => { | ||
@@ -83,5 +92,5 @@ if (opts.debug) { | ||
| }); | ||
| console.log(`\nThere is ${list.length - 1} ${arg_ext.toUpperCase()} File at the path ${colorText(path.resolve(arg_path), "0;94")}`); | ||
| console.log(`\n有 ${list.length - 1} 个 ${arg_ext.toUpperCase()} 文件在 ${colorText(path.resolve(arg_path), "0;94")} 路径下`); | ||
| }) | ||
| program.parse(); |
Sorry, the diff of this file is not supported yet
| const ws = require("wind-script"); | ||
| const project = new ws.WSrun(); | ||
| project | ||
| .setCode(`Str E = This is an error message; | ||
| E==> E;`) | ||
| .run(); |
| const ws = require("wind-script"); | ||
| const project = new ws.WSrun(); | ||
| project | ||
| .setPath(__dirname, "./helloworld.ws") | ||
| .run(); |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
11
10%1
-50%3
Infinity%10499
-0.45%244
-0.41%