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-04-26 03:39:39 +0400
committerisaacs <i@izs.me>2010-04-26 03:39:39 +0400
commit0d21c4b92743f86265cdbb63b4859c2f921c3681 (patch)
tree6d1f719aed1471a31807c42099ea064b7d0e209e /cli.js
parenta6e88bac59dfaa8be20ede469f9f7a1367e1abd0 (diff)
Initially stab at a help thing. It's not great.
Diffstat (limited to 'cli.js')
-rwxr-xr-xcli.js20
1 files changed, 2 insertions, 18 deletions
diff --git a/cli.js b/cli.js
index 633974638..8421e1033 100755
--- a/cli.js
+++ b/cli.js
@@ -20,9 +20,6 @@ var fs = require("fs")
log(sys.inspect(argv), "cli")
-// add usage onto any existing help documentation.
-npm.commands.help = usage
-
while (arg = argv.shift()) {
if (!command && (arg in npm.commands)) command = arg
else if (!key && arg.charAt(0) === "-") key = arg.replace(/^-+/, '')
@@ -33,23 +30,10 @@ while (arg = argv.shift()) {
}
if (key) conf[key] = true
-if (!command) command = "help"
-
-npm.commands[command](arglist, conf, function (er, ok) {
+if (!command) npm.commands.help.usage(sys.error)
+else npm.commands[command](arglist, conf, function (er, ok) {
if (er) {
log("failed " + er.message)
throw er
} else log("ok")
})
-
-function usage () {
- var out = (arg === "help" ? "puts" : "error");
- function p (m) { sys[out](m); return p };
- p("")
- p("Usage: ")
- p(" " + path.basename(module.filename) + " [global options] <command> [command options]")
- p("")
- p("<command> Method to call on the npm object.")
- p(" Supported: "+commands)
- p("[command options] The arguments to pass to the function.");
-}