Adds help task to gulp and the ability to provide help text to your custom gulp tasks
$ npm install --save-dev gulp-help
Before defining any tasks, add gulp help
to the gulp instance
// gulpfile.js
require('gulp-help')(gulp);
Next, define help text for each task
// gulpfile.js
gulp.task('lint', 'Lints all server side js', function () {
gulp.src('./lib/**/*.js')
.pipe(jshint(jshintrcPath))
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'));
});
Now show that help via gulp help
$ gulp help
[gulp] Running 'help'...
Usage
gulp [task]
Available tasks
help Display this help text.
lint Lints all server side js
[gulp] Finished 'help' in 607 μs
You can optionally hide a target from showing up in the help menu by passing false
as the help argument, e.g.
gulp.task('task-hidden-from-help', false, function () {
// ...
});
You can optionally add aliases to your targets by supplying an object with an aliases array, e.g.
gulp.task('version', 'prints the version.', [], function() {
// ...
}, {
aliases: ['v', 'V']
});
which results in
[gulp] Starting 'help'...
Usage
gulp [task]
Available tasks
help Display this help text.
version prints the version. Aliases: v, V
[gulp] Finished 'help' after 928 μs
Lastly, you can even override the built in help message
require('gulp-help')(gulp, { description: 'you are looking at it.', aliases: ['h', '?'] });
=>
node_modules/.bin/gulp
node_modules/.bin/gulp help
node_modules/.bin/gulp h
node_modules/.bin/gulp ?
=>
[gulp] Starting 'help'...
Usage:
gulp [task]
Available tasks:
help you are looking at it. Aliases: h, ?
[gulp] Finished 'help' after 1.05 ms