summaryrefslogtreecommitdiff
path: root/deps/npm/lib/whoami.js
blob: f1c67e2b0df9776ed21580afd6a8508f713cef98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module.exports = whoami

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

whoami.usage = "npm whoami\n(just prints the 'username' config)"

function whoami (args, silent, cb) {
  if (typeof cb !== "function") cb = silent, silent = false
  var me = npm.config.get("username")
  var msg = me ? me : "Not authed.  Run 'npm adduser'"
  if (!silent) console.log(msg)
  process.nextTick(cb.bind(this, null, me))
}