Closed petvas closed 8 years ago
vorpal .command('stringify') .option('-a, --amount <amt>', 'A number to stringify.') .types({ string: ['a', 'amount'] }) .action(function (args, cb) { this.log(args.options); cb(); });
example Outputs: stringify -a asd : { amount: 'asd' }
stringify -a asd
{ amount: 'asd' }
stringify : {}
stringify
{}
problem: --amount <amt> means it is required vorpal shousd not execute a command if required options not used.
--amount <amt>
vorpal
command
src: https://github.com/dthree/vorpal/wiki/api-%7C-vorpal.command#commandoptionstring-description-autocomplete
Per @dthree this is currently expected behavior. When you provide the option, the param is required, but the actual option itself isn't required. You can use a validate hook to ensure the option is provided.
example Outputs:
stringify -a asd
:{ amount: 'asd' }
stringify
:{}
problem:
--amount <amt>
means it is requiredvorpal
shousd not execute acommand
if required options not used.src: https://github.com/dthree/vorpal/wiki/api-%7C-vorpal.command#commandoptionstring-description-autocomplete