stefanpenner/ember-cli — pull request #1350 by James1x0 (2014-07-10 20:30:39+00:00)
Title: Allow custom commands to be accessed in blueprints

This will add in the extra nopt options to the options hash in the task.

In which case, the following works:

+ `ember generate blueprint style`
+ Edit blueprints/style/index.js:
```javascript
var fs = require('fs-extra');
var path = require('path');

module.exports = {
availableCommands: [
{ name: 'add-manifest', type: Boolean, default: false }
],
locals: function (options) {
var name = options.entity.name.replace(/-/g, " ").replace(/\w\S*/g, function (str) {
return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase();
});
return {
titledModuleName: name
};
},

afterInstall: function (options) {
if(options.addManifest) {
addStyleToManifest(options.entity.name);
}
}
};

function addStyleToManifest (name) {
var manifestPath = path.join(process.cwd(), 'app/styles/app', 'styles.less');

var oldContent = fs.readFileSync(manifestPath, 'utf-8');
var newContent = oldContent.replace(/(\/\/\sGenerated\n)/gm, '$1@import "' + name + '.less";\n');

fs.writeFileSync(manifestPath, newContent);
}
```
+ `ember generate style test-style --add-manifest` will run **addStyleToManifest**

Opens up some pretty cool options!