summaryrefslogtreecommitdiff
path: root/deps/npm/lib/bin.js
blob: 719e8870dda9c7ceb68b6af5e7e80cf8d39435d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module.exports = bin

var npm = require("./npm.js")

bin.usage = "npm bin\nnpm bin -g\n(just prints the bin folder)"

function bin (args, silent, cb) {
  if (typeof cb !== "function") cb = silent, silent = false
  var b = npm.bin
    , PATH = (process.env.PATH || "").split(":")

  if (!silent) console.log(b)
  process.nextTick(cb.bind(this, null, b))

  if (npm.config.get("global") && PATH.indexOf(b) === -1) {
    npm.config.get("logstream").write("(not in PATH env variable)\n")
  }
}