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-12-13 09:12:26 +0300
committerisaacs <i@izs.me>2010-12-13 09:12:26 +0300
commit122883c8069507f8e6215de62c1a431a141ccd86 (patch)
tree4c6de2c0824763cdc049107db3820c09c7a73ba1 /cli.js
parent19250e7aed5d0f8c85bbd8116e43ed1265b8eeab (diff)
Add shorthands for --verbose and --silent/-s to set loglevel
Diffstat (limited to 'cli.js')
-rwxr-xr-xcli.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/cli.js b/cli.js
index 849daba94..d35c959b4 100755
--- a/cli.js
+++ b/cli.js
@@ -25,7 +25,12 @@ var fs = require("./lib/utils/graceful-fs")
log.verbose(argv, "cli")
while (arg = argv.shift()) {
- if (!key && (arg.match(/^-+[h?]$/i) || arg.match(/^-+help$/i))) arg = "--usage"
+ // FIXME: This is a mess right here.
+ // FIXME: Add a "config.flags" somewhere for configs that don't take values
+ // FIXME: Add config aliases for the shorthands and such.
+ if (!key && (arg.match(/^-+[h?]$/i) || arg.match(/^-+help$/i))) {
+ arg = "--usage"
+ }
if (!key && arg.match(/^-d+$/i)) {
// -d --loglevel info
// -dd --loglevel verbose
@@ -39,6 +44,13 @@ while (arg = argv.shift()) {
default: arg = "silly"
}
}
+ if (!key && (arg.match(/^-+s$/) || arg.match(/^--silent$/))) {
+ key = "loglevel"
+ arg = "silent"
+ } else if (!key && arg.match(/^--verbose$/)) {
+ key = "loglevel"
+ arg = "verbose"
+ }
if (!command && (npm.commands.hasOwnProperty(arg))) {
if (key) {
conf[key] = true