Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cli.js
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-02-18 04:09:41 +0300
committerisaacs <i@izs.me>2010-02-18 04:09:41 +0300
commit8ec8959f67eef723a50ff0c21360bc454defd244 (patch)
treea688eeae85b25ed8d7b4f9737a666443db7bd85e /cli.js
parenta5ef5db11e1845580c443134c3c76eb16022f972 (diff)
Slight CLI tweaks.
Diffstat (limited to 'cli.js')
-rwxr-xr-xcli.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/cli.js b/cli.js
index 90770abc9..694f9c84b 100755
--- a/cli.js
+++ b/cli.js
@@ -12,7 +12,8 @@ var commands = ["help", "install"];
var npm = require("./npm"),
sys = require("sys"),
path = require("path"),
- log = require("./lib/utils").log;
+ log = require("./lib/utils").log,
+ Promise = require("events").Promise;
var argv = process.argv, arg = "";
while (argv.shift() !== module.filename);
@@ -42,8 +43,6 @@ while (arg = argv.shift()) {
} else globalOption(arg);
}
-return npm[command].apply(npm, argv);
-
function usage () {
var out = (arg === "help" ? "puts" : "error");
function p (m) { sys[out](m); return p };
@@ -57,3 +56,9 @@ function usage () {
(" Supported: "+commands)
("[command options] The arguments to pass to the function.");
}
+
+var result = npm[command].apply(npm, argv);
+if (result instanceof Promise) result
+ .addCallback(function () { log("ok") })
+ .addErrback(function () { log("failed") });
+else log("ok");