【发布时间】:2021-09-29 10:41:01
【问题描述】:
我需要处理特定选项,并将所有其他参数作为数组进一步传递。
例如:
我这样调用脚本:
node script.js --one 1 --two 2 --three 3
const args = yargs(argv).demandOption("one").string("one").argv;
console.log(args.one);
const rest = ???
console.log(rest);
应该写:
1
["--two", 2, "--three", 3]
这对 yargs 可行吗?类似于_ 的值,但_ 只包含非选项值,所以我不能使用它。
【问题讨论】:
标签: javascript yargs