Caporal.js
Caporal.js copied to clipboard
exec() does not support variadic arguments
Describe the bug
When used programmatically with exec()
, only the first variadic argument is passed to the command.
To Reproduce Steps to reproduce the behavior:
const { program } = require('@caporal/core');
program
.command('join', 'join many strings')
.argument('<str...>', 'strings')
.action(async ({args}) => {
console.log('ARGS: ', args);
});
program.exec(['join', 'a', 'b', 'c', 'd'], {silent: true});
Expected behavior
❯ node packages/cli/test/quick-test.js
ARGS: { str: ['a', 'b', 'c', 'd'] }
Actual behavior
❯ node packages/cli/test/quick-test.js
ARGS: { str: 'a' }
Environment informations (please complete the following information):
- OS: macOS
- OS version: 10.15.6
- Shell: zsh
- Caporal version: 2.0.2