Caporal.js icon indicating copy to clipboard operation
Caporal.js copied to clipboard

exec() does not support variadic arguments

Open donmccurdy opened this issue 3 years ago • 0 comments

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

donmccurdy avatar Sep 02 '20 17:09 donmccurdy