gulpjs / liftoff

Launch your command line tool with ease.
MIT License
843 stars 52 forks source link

Parse options immediately #12

Closed yocontra closed 10 years ago

yocontra commented 10 years ago

I think it would be easier if you could grab parsed args off the cli object before calling .launch

Example:

cli.on('require', function(name) {
  gutil.log('Requiring external module', chalk.magenta(name));
});

cli.launch(handleArguments);

I need to be able to implement a --silent flag that will disable the logging in the 'require' handler, but that data is not accessible until the handleArguments is called. I can parse the arguments myself but it seems like a duplication of logic/processing

tkellen commented 10 years ago

Agreed 100% about the duplication of logic. I actually have another release in the works that removes options parsing from Liftoff entirely and it is simplifying things a LOT on this end.

Instead you do something like:

cli.launch({
  configFile: myargv.gulpfile,
  cwd: myargv.cwd,
  require: myargv.require
}, cb);

I will have it ready within the week.

tkellen commented 10 years ago

as an aside, @jonschlinkert, this change came about as I worked on #8, which is still happening, but a bit further out.

jonschlinkert commented 10 years ago

thanks for the update @tkellen! no worries on my end