SamVerschueren / vscode-yo

Yeoman plugin for VS Code
MIT License
87 stars 15 forks source link

List type support #50

Open SamVerschueren opened 7 years ago

SamVerschueren commented 7 years ago

Currently we only support lists with object values like {name: 'foo', value: 'bar'}. PR #49 will add string support as well. But according to the docs of Inquirer.js, we will have to add support for some others as well.

choices: (Array|Function) Choices array or a function returning a choices array. If defined as a function, the first parameter will be the current inquirer session answers. Array values can be simple strings, or objects containing a name (to display in list), a value (to save in the answers hash) and a short (to display after selection) properties. The choices array can also contain a Separator.

So this is what should be done, and what we already have

@SBoudrias Sorry for the interruption but could you explain what that short is? When is it shown? For instance if we had a list of one item [{name: 'foo', value: 'bar', short: 'fb'}]. How does/should that render?

// @zuoez02

SBoudrias commented 7 years ago

@SamVerschueren hey, short is what is displayed once the question is answered. It might make sense for other UI to ignore this option.

Given [{name: 'foo', value: 'This is a long value', short: 'short val'}]

? Please select one:
> This is a long value
-- press ENTER --
? Please select one: short val
? Next question
SamVerschueren commented 7 years ago

@SBoudrias Wow, thanks for the quick reply :)! Yes, it seams we can safely ignore this because the selected answer is not shown as we just continue to the next question.