diff --git a/packages/cli-v3/src/cli/common.ts b/packages/cli-v3/src/cli/common.ts index f251e4e5ef4..402fa29a0dd 100644 --- a/packages/cli-v3/src/cli/common.ts +++ b/packages/cli-v3/src/cli/common.ts @@ -13,14 +13,17 @@ export const CommonCommandOptions = z.object({ apiUrl: z.string().optional(), logLevel: z.enum(["debug", "info", "log", "warn", "error", "none"]).default("log"), skipTelemetry: z.boolean().default(false), - profile: z.string().default(readAuthConfigCurrentProfileName()), + profile: z + .string() + .optional() + .transform((v) => v ?? readAuthConfigCurrentProfileName()), }); export type CommonCommandOptions = z.infer; export function commonOptions(command: Command) { return command - .option("--profile ", "The login profile to use", readAuthConfigCurrentProfileName()) + .option("--profile ", "The login profile to use") .option("-a, --api-url ", "Override the API URL", CLOUD_API_URL) .option( "-l, --log-level ", @@ -30,9 +33,9 @@ export function commonOptions(command: Command) { .option("--skip-telemetry", "Opt-out of sending telemetry"); } -export class SkipLoggingError extends Error {} -export class SkipCommandError extends Error {} -export class OutroCommandError extends SkipCommandError {} +export class SkipLoggingError extends Error { } +export class SkipCommandError extends Error { } +export class OutroCommandError extends SkipCommandError { } export async function handleTelemetry(action: () => Promise) { try {