node/deps/npm/lib/bin.js

19 lines
490 B
JavaScript
Raw Normal View History

module.exports = bin
var npm = require("./npm.js")
bin.usage = "npm bin\nnpm bin -g\n(just prints the bin folder)"
2012-07-18 02:37:39 +08:00
function bin (args, silent, cb) {
if (typeof cb !== "function") cb = silent, silent = false
var b = npm.bin
, PATH = (process.env.PATH || "").split(":")
2012-07-18 02:37:39 +08:00
if (!silent) console.log(b)
process.nextTick(cb.bind(this, null, b))
if (npm.config.get("global") && PATH.indexOf(b) === -1) {
2012-07-18 02:37:39 +08:00
npm.config.get("logstream").write("(not in PATH env variable)\n")
}
}