File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -80,12 +80,10 @@ const loginCommand = async ({ selfHosted }) => {
80
80
81
81
const whoami = new Command("whoami")
82
82
.description(commandDescriptions['whoami'])
83
- .configureHelp({
84
- helpWidth: process.stdout.columns || 80
85
- })
86
- .action(actionRunner(async () => {
83
+ .option("-j, --json", "Output in JSON format")
84
+ .action(actionRunner(async ({ json }) => {
87
85
if (globalConfig.getEndpoint() === '' || globalConfig.getCookie() === '') {
88
- error("No user is signed in");
86
+ error("No user is signed in. To sign in, run: appwrite login ");
89
87
return;
90
88
}
91
89
@@ -99,20 +97,23 @@ const whoami = new Command("whoami")
99
97
parseOutput: false
100
98
});
101
99
} catch (error) {
102
- error("No user is signed in");
100
+ error("No user is signed in. To sign in, run: appwrite login ");
103
101
return;
104
102
}
105
103
106
- success("Signed in");
107
-
108
104
const data = [
109
105
{
110
106
'ID': account.$id,
111
107
'Name': account.name,
112
108
'Email': account.email,
113
- 'MFA enabled': account.mfa
109
+ 'MFA enabled': account.mfa ? 'Yes' : 'No'
114
110
}
115
111
];
112
+ if (json) {
113
+ console.log(data);
114
+
115
+ return;
116
+ }
116
117
117
118
drawTable(data)
118
119
}));
Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ const commandDescriptions = {
168
168
"client": `The client command allows you to configure your CLI`,
169
169
"login": `The login command allows you to authenticate and manage a user account.`,
170
170
"logout": `The logout command allows you to logout of your {{ spec .title | caseUcfirst }} account.`,
171
- "whoami": `The whoami command gives a basic account information about the logged in user.`,
171
+ "whoami": `The whoami command gives information about the currently logged in user.`,
172
172
"console" : `The console command allows gives you access to the APIs used by the Appwrite console.`,
173
173
"assistant": `The assistant command allows you to interact with the Appwrite Assistant AI`,
174
174
"messaging": `The messaging command allows you to send messages.`,
You can’t perform that action at this time.
0 commit comments