grunt-prompt icon indicating copy to clipboard operation
grunt-prompt copied to clipboard

Allow choices to be a function

Open rvock opened this issue 11 years ago • 3 comments

If choices is a function you currently get an error:

Warning: Object function () {...} has no method 'map' Use --force to continue.

rvock avatar Feb 03 '14 22:02 rvock

published as [email protected] - many thanks for the PR!

dylang avatar Mar 10 '14 16:03 dylang

I have the same need, I need to define the choices dynamically. You say you has already in 1.1.0, but the documentation does not detail how to use anything. How can this be done?

I tried something like:

choices: function() {
    return {name: 'x', value: true}
}

But the following error ocurred:

Warning: Object # has no method 'setRender' Use --force to continue.

fredw avatar May 06 '14 22:05 fredw

I'm sorry, I did wrong. But anyway it would be interesting if there were registered in the documentation:

choices: function() {
    return [{name: 'x', value: true}]
}

fredw avatar May 06 '14 22:05 fredw