A wizard to select the desired task and options
This plugin requires Grunt.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-wizard --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-wizard');
In your project's Gruntfile, add a section named wizard
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
wizard: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
})
Type: String
Default value: 'Choose a task to run'
Type: Object|Function
A list of tasks and parameters
If you just want to see this plugin in action clone the repository and launch grunt:
git clone https://github.com/jantimon/grunt-wizard
grunt
In this example, the prompt will ask to choose between nodeunit and jshint:
grunt.initConfig({
wizard: {
default: {
options: {
choices: {
'nodeunit': 'Test the plugin',
'jshint': 'Check for common js errors'
}
}
}
},
})
In this example the result will be the same as in default options however the choices are build up in a function
grunt.initConfig({
wizard: {
default: {
options: {
message: 'Choose a task to run',
choices: function(){
return {
'nodeunit': 'Test the plugin',
'jshint': 'Check for common js errors'
};
}
}
},
})
It is also possible to set custom parameter values
grunt.initConfig({
wizard: {
default: {
options: {
message: 'Choose a task to run',
choices: function(){
return {
'nodeunit': {
label: 'Test the plugin',
parameter: [{
name: '--customParameter',
message: 'Choose a value for --customParameter',
choices: {
'blue': 'Run all tests in blue',
'red': 'Run all tests in red'
}
},
{
name: '--anotherCustomParameter',
message: 'Choose a value for --anotherCustomParameter',
choices: ['yellow', 'black']
}]
}
},
'jshint': 'Check for common js errors'
};
}
}
},
})
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)
Copyright (c) 2014 Jan Nicklas. Licensed under the MIT license.