m19c / gulp-run

Pipe to shell commands in gulp
ISC License
151 stars 25 forks source link

Hoe to take the argument from command-line? #24

Closed siavash13 closed 9 years ago

siavash13 commented 9 years ago

I need to take an argument from the command line and use it in the gulp-file ? This is my gulpfile.js var run = require('gulp-run');

   gulp.task('default', function () {
     run('echo Hello user').exec() 
      .pipe(gulp.dest('output'))    
   })

How can I take an argument from Command line and pass it to this file , so that hello argument1 is pprinted instead of hello user?

cbarrick commented 9 years ago

I believe your question may be outside of the scope of this project. But something like this might work:

gulp.task('default', function () {
     run('echo Hello ' + process.argv[1]).exec() 
      .pipe(gulp.dest('output'))    
   })