nv-cli-ifelse
Version:
cli,to write many if else
54 lines (45 loc) • 1.16 kB
JavaScript
const path = require('path');
const child_process = require("child_process");
const fs = require("fs");
const mist = require('minimist');
const build = require("./quick")
function creat_argv() {
let argv = mist(
process.argv.slice(2),
{
alias: {
'help':'h',
'maxsize':'m',
'depth':'d',
'children_count':'c'
},
default: {
'maxsize':10000,
'depth':1,
'children_count':10
}
}
);
return(argv)
}
function usage () {
console.log(
`
Usage: nv_if_quick [options]
Options:
-d, --depth depth,default 1
-c, --children_count child if/elif/else count,default 10
-m, --maxsize the max-supported nodes,default 10000
-h, --help Output usage information`
)
console.log("\n");
}
function run(k) {
let argv = creat_argv();
if (argv.help) {
usage();
} else {
console.log(build(argv.m,argv.d,argv.c))
}
}
module.exports = run