Skip to content

Instantly share code, notes, and snippets.

@scottcorgan
Created September 11, 2015 22:30
Show Gist options
  • Save scottcorgan/3e7bd2bc6328e3c71e0a to your computer and use it in GitHub Desktop.
Save scottcorgan/3e7bd2bc6328e3c71e0a to your computer and use it in GitHub Desktop.
var opts = {
log: require('./logger'),
fs: require('./fs')
};
var someCommand(
name('something'),
use(function (data, flags, options) {
options.log('hey!');
options.fs.write('something');
});
);
var run = cli(
options(opts) // these are global options to all commands and flags
someCommand(/* command specific options here */)
);
// Note: global options and local options get merged
run(process.argv.slice(2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment