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
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-07-02 20:50:33 +0400
committerisaacs <i@izs.me>2014-07-02 21:33:27 +0400
commit0353ddeaca8171aa7dbdd8102b7e2eb581a86406 (patch)
tree19be2385e9ac676843867b1503d4052cf98c4eaf
parent1e099c556f230634c4de790be8662c6cdef2e38a (diff)
version: respect --json for output
-rw-r--r--lib/version.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/version.js b/lib/version.js
index f83eedd71..95d5ff2ee 100644
--- a/lib/version.js
+++ b/lib/version.js
@@ -38,6 +38,9 @@ function version (args, silent, cb_) {
if (data && data.name && data.version) {
v[data.name] = data.version
}
+ if (npm.config.get("json")) {
+ v = JSON.stringify(v, null, 2)
+ }
console.log(v)
return cb_()
}