diff options
author | isaacs <i@izs.me> | 2012-02-23 23:11:38 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-02-23 23:11:38 +0400 |
commit | b6c8d31799cf6197f7fac007a474ff02b0efc809 (patch) | |
tree | e7f984a1ed14db6d7df66d36cea914c25fc4bf1f | |
parent | f322b0d00a47e847bb894618f45a6aca35035b6b (diff) |
Add --versions flag to show the version of node as well
For @mcavage
-rwxr-xr-x | bin/npm-cli.js | 7 | ||||
-rw-r--r-- | doc/cli/config.md | 10 | ||||
-rw-r--r-- | lib/utils/config-defs.js | 2 |
3 files changed, 19 insertions, 0 deletions
diff --git a/bin/npm-cli.js b/bin/npm-cli.js index e0b9f20bb..f29437093 100755 --- a/bin/npm-cli.js +++ b/bin/npm-cli.js @@ -49,6 +49,13 @@ if (conf.version) { return } +if (conf.versions) { + var v = process.versions + v.npm = npm.version + console.log(v) + return +} + log.info("npm@"+npm.version, "using") log.info("node@"+process.version, "using") diff --git a/doc/cli/config.md b/doc/cli/config.md index 9b3da04c6..5c4750072 100644 --- a/doc/cli/config.md +++ b/doc/cli/config.md @@ -682,6 +682,16 @@ If true, output the npm version and exit successfully. Only relevant when specified explicitly on the command line. +### versions + +* Default: false +* Type: boolean + +If true, output the npm version as well as node's `process.versions` +hash, and exit successfully. + +Only relevant when specified explicitly on the command line. + ### viewer * Default: "man" on Posix, "browser" on Windows diff --git a/lib/utils/config-defs.js b/lib/utils/config-defs.js index d368c4972..3cecb5052 100644 --- a/lib/utils/config-defs.js +++ b/lib/utils/config-defs.js @@ -206,6 +206,7 @@ Object.defineProperty(exports, "defaults", {get: function () { , userignorefile : path.resolve(home, ".npmignore") , umask: 022 , version : false + , versions : false , viewer: process.platform === "win32" ? "browser" : "man" , yes: null @@ -279,6 +280,7 @@ exports.types = , userignorefile : path , umask: Octal , version : Boolean + , versions : Boolean , viewer: String , yes: [false, null, Boolean] , _exit : Boolean |