Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to skip a prompt #73

Open
gamtiq opened this issue Mar 9, 2014 · 0 comments
Open

Ability to skip a prompt #73

gamtiq opened this issue Mar 9, 2014 · 0 comments

Comments

@gamtiq
Copy link
Contributor

gamtiq commented Mar 9, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant