bot/node_modules/npm/lib/commands/whoami.js

18 lines
523 B
JavaScript
Raw Normal View History

2022-02-16 11:32:42 +01:00
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