0.1.2 • Published 9 years ago

gulp-command v0.1.2

Weekly downloads
23
License
ISC
Repository
github
Last release
9 years ago

gulp-command

Use Commander-CLI options in Gulp for passing Command line flags

Gulp Command is currently working, However it does not provide all the necessary options quite yet.

Build Status NPM version

Getting Started

Install the module with: npm install gulp-command

Her is an example of how to use gulp-command

var gulp        = require('gulp');
var gulpCommand = require('gulp-command')(gulp);

gulp
    .option('<related-task>', '-f, --flag', 'Description', 'callback')
  • Related-Task: optional

  • -f, --flag: required (both short and long flag are required comma Separated);

  • description: required
  • Callback: optional

If No Related task is specified, the commands can apply to all tasks

However, You still need to pass null If you are not using a task

gulp
    .option(null, '-f, --flag', 'Description', 'callback')

##How to access the flags! As an example, If I used the following flags.

gulp build --thing=awesome -s soo -s totally -s cool

After passing an option property, within then gulp task, you can simply

gulp
    .option('build', '-t, --thing', 'Awesome Thing')
    .option('build', '-s, --sweetness', 'So Totally Cool')
    .task('build', function(){
        console.log(this.flags)
        => {t:'awesome', sweetness: ['so', 'totally', 'awesome']};
    });

If we were to run the same command, but under the default task, we would get the following;

gulp default --thing=awesome -s soo -s totally -s cool
gulp
    .task('default', function(){
        console.log(this.flags)
        => {}
    });

gulp
    .option('build', '-t, --thing', 'Awesome Thing')
    .option('build', '-s, --sweetness', 'So Totally Cool')
    .task('build', function(){
        
    });

Docs

  • documentation - Comming Soon.
  • support - open an issue here.

License

MIT © 2014, joelcoxokc