UNPKG

386 BJavaScriptView Raw
1module.exports = whoami
2
3var npm = require("./npm.js")
4
5whoami.usage = "npm whoami\n(just prints the 'username' config)"
6
7function whoami (args, silent, cb) {
8 if (typeof cb !== "function") cb = silent, silent = false
9 var me = npm.config.get("username")
10 msg = me ? me : "Not authed. Run 'npm adduser'"
11 if (!silent) console.log(msg)
12 process.nextTick(cb.bind(this, null, me))
13}