gpt4 book ai didi

javascript - 如何有多个输入文件?

转载 作者:行者123 更新时间:2023-12-02 20:51:48 24 4
gpt4 key购买 nike

我需要将多个输入文件传递到命令行应用程序,但是当我这样做时

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com