dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.64k stars 280 forks source link

`required` `option` are acting like `optional` #136

Closed petvas closed 8 years ago

petvas commented 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 : {}

problem: --amount <amt> means it is required vorpal shousd not execute a command if required options not used.

src: https://github.com/dthree/vorpal/wiki/api-%7C-vorpal.command#commandoptionstring-description-autocomplete

scotthovestadt commented 8 years ago

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.