mirror of
https://github.com/nodejs/node.git
synced 2025-05-17 16:03:23 +00:00

PR-URL: https://github.com/nodejs/node/pull/40726 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
28 lines
730 B
JavaScript
28 lines
730 B
JavaScript
const getIdentity = require('../utils/get-identity.js')
|
|
|
|
const BaseCommand = require('../base-command.js')
|
|
class Whoami extends BaseCommand {
|
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
|
static get description () {
|
|
return 'Display npm username'
|
|
}
|
|
|
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
|
static get name () {
|
|
return 'whoami'
|
|
}
|
|
|
|
/* istanbul ignore next - see test/lib/load-all-commands.js */
|
|
static get params () {
|
|
return ['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
|