PR-URL: https://github.com/nodejs/node/pull/46193 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
16 lines
474 B
JavaScript
16 lines
474 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
|