node/deps/npm/lib/commands/whoami.js
npm team 8a03482cf1
deps: upgrade npm to 8.1.4
PR-URL: https://github.com/nodejs/node/pull/40865
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-11-22 09:37:01 +01:00

17 lines
467 B
JavaScript

const getIdentity = require('../utils/get-identity.js')
const BaseCommand = require('../base-command.js')
class Whoami extends BaseCommand {
static description = 'Display npm username'
static name = 'whoami'
static params = ['registry']
async exec (args) {
const username = await getIdentity(this.npm, this.npm.flatOptions)
this.npm.output(
this.npm.config.get('json') ? JSON.stringify(username) : username
)
}
}
module.exports = Whoami