mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
b488be127a
.msi update coming soon.
23 lines
509 B
JavaScript
Executable File
23 lines
509 B
JavaScript
Executable File
var argv = process.argv
|
|
if (argv.length < 3) {
|
|
console.error("Usage: read-package.json <file> [<fields> ...]")
|
|
process.exit(1)
|
|
}
|
|
|
|
var fs = require("fs")
|
|
, file = argv[2]
|
|
, readJson = require("../lib/utils/read-json")
|
|
|
|
readJson(file, function (er, data) {
|
|
if (er) throw er
|
|
if (argv.length === 3) console.log(data)
|
|
else argv.slice(3).forEach(function (field) {
|
|
field = field.split(".")
|
|
var val = data
|
|
field.forEach(function (f) {
|
|
val = val[f]
|
|
})
|
|
console.log(val)
|
|
})
|
|
})
|