作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要将多个输入文件传递到命令行应用程序,但是当我这样做时
test --input k1.toml k2.toml k3.toml --project xxx --username xxx
'use strict'
var minimist = require('minimist')
var argv = minimist(process.argv.slice(2), {
string: ['input', 'project', 'username',],
boolean: ['help'],
alias: { i: 'input' },
unknown: function () { console.log('Unkown argument') }
})
console.log(argv)
Unkown argument
Unkown argument
{ _: [ 'k2.toml', 'k3.toml' ],
help: false,
input: '1.toml',
i: 'k1.toml',
project: 'xxx',
username: 'xxx' }
input
是文件名的数组。在这里,它认为文件名是参数,因此会触发
unknown: function ()
。
minimist
的限制,我愿意使用不同于
minimist
的东西。
最佳答案
请查看yargs软件包。
关于javascript - 如何有多个输入文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61589791/
我是一名优秀的程序员,十分优秀!