mirror of
https://github.com/nodejs/node.git
synced 2025-05-16 18:57:28 +00:00

PR-URL: https://github.com/nodejs/node/pull/41836 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com>
18 lines
523 B
JavaScript
18 lines
523 B
JavaScript
const getIdentity = require('../utils/get-identity.js')
|
|
const log = require('../utils/log-shim.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, log })
|
|
this.npm.output(
|
|
this.npm.config.get('json') ? JSON.stringify(username) : username
|
|
)
|
|
}
|
|
}
|
|
module.exports = Whoami
|