安装:npm install yargs --save-dev
Example
index.js
const argv = yargs.alias('n', 'name').alias('p', 'port').alias('t', 'tpl').argv
console.log(argv.name);
命令行输入: $ node index.js -n fuck -p 8080 -tpl components
安装:npm install yargs --save-dev
Example
index.js
const argv = yargs.alias('n', 'name').alias('p', 'port').alias('t', 'tpl').argv
console.log(argv.name);
命令行输入: $ node index.js -n fuck -p 8080 -tpl components
转载于:https://www.cnblogs.com/CyLee/p/8434431.html