Skip to content

Instantly share code, notes, and snippets.

@ruyadorno
Last active August 29, 2015 14:05
Show Gist options
  • Save ruyadorno/9f1ecb0aa48f1e1ec404 to your computer and use it in GitHub Desktop.
Save ruyadorno/9f1ecb0aa48f1e1ec404 to your computer and use it in GitHub Desktop.
Get yeoman option from command-line
var yeoman = require('yeoman-generator');
var argv = require('minimist')(process.argv.slice(2));
module.exports = yeoman.generators.Base.extend({
constructor: function (args, options) {
if (options['module-name']) {
// don't really remember why getting from argv with an options fallback
this.moduleName = argv['module-name'] || options['module-name'];
} else {
// calls inquirer and set the property in the usual way
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment