This commit is contained in:
André Cruz
2013-05-31 19:11:21 +01:00
parent 7fb326245e
commit 41486d44ee
7 changed files with 15 additions and 10 deletions

View File

@@ -13,6 +13,7 @@ var options;
var renderer;
var loglevel;
var command;
var emitter;
var notifier;
var levels = {
'error': 5,
@@ -56,11 +57,11 @@ if (!commands[command]) {
}
// Execute the command
command = commands[command].line(process.argv);
emitter = commands[command].line(process.argv);
// Connect the command output to the renderer
renderer = cli.getRenderer(command.name, config);
command
renderer = cli.getRenderer(emitter.command, config);
emitter
.on('end', function (data) {
if (!config.silent) {
renderer.end(data);

View File

@@ -15,7 +15,7 @@ function help(name) {
emitter.emit('end', json);
});
emitter.name = 'help';
emitter.command = 'help';
return emitter;
}

View File

@@ -27,7 +27,7 @@ function install(endpoints, options, config) {
emitter.emit('notification', notification);
});
emitter.name = 'install';
emitter.command = 'install';
return emitter;
}

View File

@@ -27,7 +27,7 @@ function uninstall(endpoints, options, config) {
emitter.emit('notification', notification);
});
emitter.name = 'uninstall';
emitter.command = 'uninstall';
return emitter;
}

View File

@@ -27,7 +27,7 @@ function update(endpoints, options, config) {
emitter.emit('notification', notification);
});
emitter.name = 'update';
emitter.command = 'update';
return emitter;
}

View File

@@ -76,7 +76,11 @@ StandardRenderer.prototype.updateNotice = function (data) {
// -------------------------
StandardRenderer.prototype._install = function (installed) {
// TODO
// TODO: render tree of installed packages
};
StandardRenderer.prototype._update = function (updated) {
// TODO: render tree of updated packages
};
StandardRenderer.prototype._help = function (data) {
@@ -93,7 +97,7 @@ StandardRenderer.prototype._help = function (data) {
.then(function (str) {
that._write(process.stdout, str);
}, function (err) {
// If it failed with something else than ENOENTm
// If it failed with something else than ENOENT
// error out
if (err.code !== 'ENOENT') {
return err;

View File

@@ -26,7 +26,7 @@
{
"shorthand": "-j",
"flag": "--json",
"description": "Output consumable JSON output"
"description": "Output consumable JSON"
},
{
"shorthand": "-l",