node/deps/npm/lib/root.js

12 lines
305 B
JavaScript
Raw Normal View History

module.exports = root
var npm = require("./npm.js")
root.usage = "npm root\nnpm root -g\n(just prints the root folder)"
2012-07-18 02:37:39 +08:00
function root (args, silent, cb) {
if (typeof cb !== "function") cb = silent, silent = false
if (!silent) console.log(npm.dir)
2012-07-20 04:03:28 +08:00
process.nextTick(cb.bind(this, null, npm.dir))
}