blob: bbbc39cceceb586801cb811cc9ddc2c90b65848c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
const npm = require('./npm.js')
const output = require('./utils/output.js')
const getIdentity = require('./utils/get-identity.js')
const usageUtil = require('./utils/usage.js')
const cmd = (args, cb) => whoami(args).then(() => cb()).catch(cb)
const usage = usageUtil('whoami', 'npm whoami [--registry <registry>]\n(just prints username according to given registry)')
const whoami = async ([spec]) => {
const opts = npm.flatOptions
const username = await getIdentity(opts, spec)
output(opts.json ? JSON.stringify(username) : username)
}
module.exports = Object.assign(cmd, { usage })
|