UNPKG

1.38 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const tslib_1 = require("tslib");
4const base_1 = tslib_1.__importStar(require("../base"));
5class Whoami extends base_1.default {
6 async run() {
7 this.parse(Whoami);
8 const config = await this.isLoggedIn();
9 this.log('\n');
10 this.log(`${this.ux.colors.green(this.ux.colors.bold(' Email: '))}${config.user.email}`);
11 this.log(`${this.ux.colors.green(this.ux.colors.bold(' Username: '))}${config.user.username}`);
12 this.log(`${this.ux.colors.green(this.ux.colors.bold(' Team Name: '))}${config.team.name}`);
13 if (config.user.registryHost) {
14 this.debug(`${this.ux.colors.green(this.ux.colors.bold('\n OPS_REGISTRY_HOST: '))}${config.user.registryHost}`);
15 }
16 if (config.user.nodeEnv) {
17 this.debug(`${this.ux.colors.green(this.ux.colors.bold(' NODE_ENV: '))}${config.user.nodeEnv}`);
18 }
19 this.log('\n');
20 this.services.analytics.track({
21 userId: this.user.email,
22 teamId: this.team.id,
23 cliEvent: 'Ops CLI Whoami',
24 event: 'Ops CLI Whoami',
25 properties: {},
26 }, this.accessToken);
27 }
28}
29exports.default = Whoami;
30Whoami.description = 'Display your user information';
31Whoami.flags = {
32 help: base_1.flags.help({ char: 'h' }),
33};