diff options
author | isaacs <i@izs.me> | 2010-04-26 03:39:39 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-04-26 03:39:39 +0400 |
commit | 0d21c4b92743f86265cdbb63b4859c2f921c3681 (patch) | |
tree | 6d1f719aed1471a31807c42099ea064b7d0e209e /cli.js | |
parent | a6e88bac59dfaa8be20ede469f9f7a1367e1abd0 (diff) |
Initially stab at a help thing. It's not great.
Diffstat (limited to 'cli.js')
-rwxr-xr-x | cli.js | 20 |
1 files changed, 2 insertions, 18 deletions
@@ -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."); -} |