-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
export class FooCommand extends Command {
static paths = [['foo']]
idList = Option.Rest({
name: 'id list',
})
extraArgs = Option.Proxy()
async execute() {
}
}when exec cli foo id1 id2 -- -p ALL error logs:
Error: Infinite lists cannot be declared multiple times in the same command
at CommandBuilder.addRest (/tmp/demo/node_modules/.pnpm/clipanion@3.2.1_typanion@3.12.1/node_modules/clipanion/lib/core.js:564:19)
at CommandBuilder.addProxy (/tmp/demo/node_modules/.pnpm/clipanion@3.2.1_typanion@3.12.1/node_modules/clipanion/lib/core.js:572:14)
at definition (/tmp/demo/node_modules/.pnpm/clipanion@3.2.1_typanion@3.12.1/node_modules/clipanion/lib/advanced/options/Proxy.js:24:21)
at Cli.register (/tmp/demo/node_modules/.pnpm/clipanion@3.2.1_typanion@3.12.1/node_modules/clipanion/lib/advanced/Cli.js:139:13)
at <anonymous> (/tmp/demo/src/cli.ts:31:5)
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
and I noticed that Option.Proxy() will consume all args after last path component.
It would be nice to support explicit proxied args, separated by --.
and In my case, assign components before -- to Option.Rest() [id1, id2], and after -p ALL to Option.Proxy(), so things like for(id of bvidList) exec(other-command ${id} ${extraArgs}) can be done.
Current if only use Option.Rest() with cli foo id1 id2 -- -p ALL, idList will be [ 'id1', 'id2', '-p', 'ALL' ], there is no clear remark to manual split them into [id1, id2] & [-p, ALL]
Thanks for your works anyway~
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels