dthree / vorpal

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

Options not working as intended? #183

Closed moustacheful closed 8 years ago

moustacheful commented 8 years ago

Given the following task

vorpal
  .command('greet', 'Greets something')
  .option('--target', 'Who to greet', ['Jimmy', 'Bob', 'Jon'])
  .action(function (args) {
    this.log('Hello', args.options.target);
    return Promise.resolve();
  });

Upon attempting execution and successfully getting the autocomplete options, the arguments list the option as true instead of the intended value.

eg:

$greet --target Jim[tab] 
$greet --target Jimmy

Which logs the following as a result:

Hello true

This is the case regardless if option is given an array / function / promise Am I doing something wrong? docs error maybe?

moustacheful commented 8 years ago

Reminder to self: RTFM Didn't realize the option definition needed an optional or required parameter if you need the value.

My bad!