0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/deps/npm/lib/whoami.js

14 lines
390 B
JavaScript
Raw Normal View History

module.exports = whoami
var npm = require("./npm.js")
whoami.usage = "npm whoami\n(just prints the 'username' config)"
2012-07-17 20:37:39 +02:00
function whoami (args, silent, cb) {
if (typeof cb !== "function") cb = silent, silent = false
var me = npm.config.get("username")
2014-07-31 18:05:30 +02:00
var msg = me ? me : "Not authed. Run 'npm adduser'"
2012-07-17 20:37:39 +02:00
if (!silent) console.log(msg)
process.nextTick(cb.bind(this, null, me))
}