-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
it often makes sense to have the same argument repeated multiple times (both named and positional)
e.g. with arg it's possible to do something like this:
const args = arg({
'--foo': [String]
} as const, { permissive: true })
console.log(args)which would result in something like this:
$ node test.js --foo=1 --foo=2 1 2 3 4
{
_: ['1', '2', '3', '4'],
'--foo': ['1', '2'],
}
this is currently not possible with brocli however :c
the best workaround currently is to use e.g. comma delimiter and manually split them, which is obviously not ideal – you have to account for the comma being a part of one of the items, and it also looks awkward as positional args
my proposed api would look something like this:
const foo = command({
name: 'foo',
options: {
foo: string().repeated(),
bar: positional().repeated()
},
handler: console.log
})which would print a similar output to the above
ihusemann
Metadata
Metadata
Assignees
Labels
No labels