javascript - Is it possible to prompt user for input in any grunt task? -
i'm attempting use grunt make directory in project new posts blog. create directory inside of posts
directory named yyyymmdddd-postnameinpascalcase
.
in order this, i'd have prompt user post name each time execute task. know grunt-init prompts users creating projects project templates, i'm curious if there's way inside gruntfile.js
file established project.
any thoughts?
it's been while since question last asked, there project on github attempts questioner looking for. it's called grunt-prompt
, here's url: https://github.com/dylang/grunt-prompt. it's way integrate prompts gruntfile. project readme like:
grunt.initconfig({ prompt: { target: { options: { questions: [ { config: 'config.name', // arbitray name or config other grunt task type: '<question type>', // list, checkbox, confirm, input, password message: 'question ask user', default: 'value', // default value if nothing entered choices: 'array|function(answers)', validate: function(value), // return true if valid, error message if invalid filter: function(value), // modify answer when: function(answers) // ask question when function returns true } ] } }, }, })
Comments
Post a Comment