dthree / vorpal

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

Option list is not being printed #162

Closed alansouzati closed 8 years ago

alansouzati commented 8 years ago

I'm trying this example from the home page:

const vorpal = require('vorpal')();

const foods = ['burgers', 'chinese', 'pizza', 'sushi'];
const methods = ['a la carte', 'table d\'hote'];
const commandHelp = 'Order a type of food';
const optionHelp = 'How you want your meal served';

vorpal
  .command('order ', commandHelp)
  .option('--method [method]', optionHelp, methods)
  .autocomplete(foods)
  .action(function (args, cb) {
    const food = args.food;
    const method = args.options.method;
    this.log(`You ordered ${food} ${method}.`);
    cb();
  });

If I type:

order: instead of seeing burgers chinese pizza sushi, I see You ordered undefined undefined.

Same for order sushi --method.

I'm assuming there is a change in the API? What is the proper way to do this now?

I'm basically trying to show the list of available methods.

alansouzati commented 8 years ago

I'm using vorpal 1.11.2

alansouzati commented 8 years ago

Nevermind, I was pressing enter instead of tab. I should have read the documentation more carefully.

dthree commented 8 years ago

All good. Feel free to post questions on StackOverflow under the vorpal.js tag - they will probably get answered faster. I get email alerts on that tag.