【发布时间】:2016-05-10 03:25:51
【问题描述】:
大家好!
我需要有关 commander node.js 库的帮助。我需要创建这个接受 3 个标志的 CLI,--input、--output 和 --pattern,例如:
commander
.version('3.0.0')
.usage('[options] <file ...>')
.option('-i, --input', 'Array of files to be extracted')
.option('-o, --output', 'Output file name')
.option('-p, --pattern', 'Pattern name to be used in the extraction')
.parse(process.argv);
我的问题在于输入标志。我需要发送几个文件,为此我需要一个数组数据类型。
问题是:我就是不知道怎么做:
node ./bin/extract -i ../files/*.PDF
成为一个数组,其中包含我的文件目录中的所有文件。我已经尝试运行文档中的每个示例,但我没有找到解决问题的方法。另外,我搜索了这些问题,也没有找到......有什么奇怪的,也许我做错了什么,你们可以帮忙吗??
谢谢!
【问题讨论】:
标签: javascript arrays node.js command-line-interface