Merge pull request #71 from hybridgroup/subcommands

Cylon Subcommands
This commit is contained in:
Ron Evans 2014-01-13 16:25:35 -08:00
commit 17154d8d04
1 changed files with 17 additions and 0 deletions

View File

@ -12,6 +12,23 @@ program
.description("Generates a new adaptor")
.action(function(name) { require('../src/generators/adaptor')(name) });
// require all cylon-* modules
require('fs').readdirSync(process.cwd() + '/node_modules/').forEach(function(dir) {
if (dir.match(/^cylon-.*/) !== null) {
if (typeof require(dir).registerCommands === 'function') {
var commands = require(dir).registerCommands();
for (name in commands) {
var command = commands[name];
program
.command(name)
.description(command.description)
.action(command.command);
}
}
}
});
program.parse(process.argv);
// print help if no arguments were provided