Code Monkey home page Code Monkey logo

gulp-command's Introduction

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

gulp-command's People

Contributors

joelcoxokc avatar soxbox avatar dignifiedquire avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.