node/deps/npm/lib/whoami.js

14 lines
386 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-18 02:37:39 +08:00
function whoami (args, silent, cb) {
if (typeof cb !== "function") cb = silent, silent = false
var me = npm.config.get("username")
2012-07-18 02:37:39 +08:00
msg = me ? me : "Not authed. Run 'npm adduser'"
if (!silent) console.log(msg)
process.nextTick(cb.bind(this, null, me))
}