Skip to content

Commit 7ea6c37

Browse files
committed
refactor: simplify profile resolution to align with codebase patterns
- Rely on Zod schema default (readAuthConfigCurrentProfileName) for --profile fallback - Use consistent 'default' fallback pattern like other commands - Remove redundant readAuthConfigCurrentProfileName call - Maintain whitespace trimming for user input robustness
1 parent 449ee2d commit 7ea6c37

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/cli-v3/src/commands/whoami.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ export async function whoAmI(
7474
embedded: boolean = false,
7575
silent: boolean = false
7676
): Promise<WhoAmIResult> {
77-
// When no --profile is passed, Zod schema defaults to readAuthConfigCurrentProfileName()
78-
// which returns the current profile from config or "default" if none exists.
79-
// If --profile is passed, we trim whitespace and fallback to current profile if empty.
80-
const profileToUse = options?.profile?.trim() || readAuthConfigCurrentProfileName();
77+
// Profile is provided by Zod schema with default from readAuthConfigCurrentProfileName()
78+
// Trim whitespace and fallback to "default" for consistency with other commands
79+
const profileToUse = options?.profile?.trim() || "default";
8180

8281
if (!embedded) {
8382
intro(`Displaying your account details [${profileToUse}]`);

0 commit comments

Comments
 (0)