nodejs/deps/npm/lib/commands/whoami.js
npm CLI robot 063afa85fe
deps: upgrade npm to 10.8.1
PR-URL: https://github.com/nodejs/node/pull/53207
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
2024-05-30 11:21:05 +00:00

21 lines
527 B
JavaScript

const { output } = require('proc-log')
const getIdentity = require('../utils/get-identity.js')
const BaseCommand = require('../base-cmd.js')
class Whoami extends BaseCommand {
static description = 'Display npm username'
static name = 'whoami'
static params = ['registry']
async exec () {
const username = await getIdentity(this.npm, { ...this.npm.flatOptions })
if (this.npm.config.get('json')) {
output.buffer(username)
} else {
output.standard(username)
}
}
}
module.exports = Whoami