Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Commit 1988cd1

Browse files
MaxAnton Cherednikov
authored andcommitted
PTF-1349: whoami message updated
1 parent afa6300 commit 1988cd1

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codestore",
33
"description": "code.store CLI. Add services, deploy, debug, perform all operations from your terminal.",
4-
"version": "1.9.9",
4+
"version": "1.9.10",
55
"bin": {
66
"codestore": "./bin/run",
77
"cs": "./bin/run"

src/commands/auth/login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ export default class Login extends Command {
2222
const user = await this.codestore.getMe();
2323

2424
ux.action.stop(blue('Done'));
25-
this.log(blue(`👋 Welcome to code.store, dear ${user.firstName}`));
25+
this.log(blue(`👋 Welcome to code.store${user.firstName ? `, dear ${user.firstName}` : ''}`));
2626
}
2727
}

src/commands/auth/whoami.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,19 @@ export default class Whoami extends Command {
1414
public async execute(): Promise<void> {
1515
try {
1616
const user: IUser = await this.codestore.getMe();
17-
this.log(`You're ${chalk.cyan(user.firstName)}, officially ${chalk.cyan(user.lastName)} using ${chalk.cyan(user.email)} as main email${user?.organization?.name ? ` and working for ${chalk.cyan(user.organization.name)}` : ''}. Oh, and you're amazing!`);
17+
let welcomeMessage = "You're";
18+
if (user.firstName) {
19+
welcomeMessage += `${chalk.cyan(user.firstName)},`;
20+
}
21+
if (user.lastName) {
22+
welcomeMessage += ` officially ${chalk.cyan(user.lastName)}`;
23+
}
24+
welcomeMessage += ` using ${chalk.cyan(user.email)} as main email`;
25+
if (user?.organization?.name) {
26+
welcomeMessage += ` and working for ${chalk.cyan(user.organization.name)}`;
27+
}
28+
welcomeMessage += ". Oh, and you're amazing!";
29+
this.log(welcomeMessage);
1830
} catch (error) {
1931
if (error.message === 'GraphQL error: Bad JWT token.') {
2032
throw new NotAuthorizedError();

src/lib/command.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export default abstract class Command extends Base {
3030

3131
public static apiPath = process.env.CODESTORE_GATEWAY_HOST || 'https://api.code.store';
3232

33+
public static appPath = process.env.CODESTORE_APP_HOST || 'https://app.code.store';
34+
3335
public get codestore(): APIClient {
3436
return this._codestore;
3537
}

0 commit comments

Comments
 (0)