IMHO one of important features that grunt-init lacks is ability to skip a question (prompt) depending on answers for previous questions (results of previous prompts).
For example, consider the following excerpt (actually it is prompts from grunt-init-pack template):
{
name: "travis",
message: "Will this project be tested with Travis CI?",
"default": "Y/n",
warning: "If selected, you must enable Travis support for this project in https://travis-ci.org/profile",
sanitize: convertYesNo
},
{
name: "travis_badge",
message: "Would you like to include Travis build status badge into README.md?",
"default": function(value, data, done) {
done(null, yesRegExp.test(data.travis) ? "Y/n" : "y/N");
},
sanitize: convertYesNo
},
When a user answers no for travis prompt, travis_badge prompt should be skipped. Unfortunately it is impossible in current version.
I propose to add support for prompt's options that will allow specifying pre-action and maybe post-action (of course they should be functions). Let’s name those actions before and after. So that when false value (exactly) is returned from before action, the corresponding prompt will be skipped.
What do you think about this?
I can make pull request if this proposal will be approved.
IMHO one of important features that
grunt-init
lacks is ability to skip a question (prompt) depending on answers for previous questions (results of previous prompts). For example, consider the following excerpt (actually it is prompts from grunt-init-pack template):When a user answers
no
fortravis
prompt,travis_badge
prompt should be skipped. Unfortunately it is impossible in current version.I propose to add support for prompt's options that will allow specifying pre-action and maybe post-action (of course they should be functions). Let’s name those actions
before
andafter
. So that whenfalse
value (exactly) is returned frombefore
action, the corresponding prompt will be skipped. What do you think about this? I can make pull request if this proposal will be approved.