2011-11-22 01:48:45 +08:00
|
|
|
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
|
2011-11-22 01:48:45 +08:00
|
|
|
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))
|
2011-11-22 01:48:45 +08:00
|
|
|
}
|