MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / resolveCommonOptions

Function resolveCommonOptions

src/commands/project.ts:486–504  ·  view source on GitHub ↗
(command: Command)

Source from the content-addressed store, hash-verified

484}
485
486function resolveCommonOptions(command: Command): CommonOptions {
487 const globals = command.optsWithGlobals() as Partial<CommonOptions> & {
488 requestTimeout?: string;
489 };
490 // P2-8: validate --output before allowing silent fallback to 'text'.
491 const rawOutput = globals.output;
492 if (rawOutput !== undefined && rawOutput !== 'json' && rawOutput !== 'text') {
493 throw localValidationError('--output must be one of: json, text');
494 }
495 return {
496 profile: globals.profile ?? 'default',
497 output: (globals.output as OutputMode | undefined) ?? 'text',
498 endpointUrl: globals.endpointUrl,
499 debug: globals.debug ?? false,
500 verbose: globals.verbose ?? false,
501 dryRun: globals.dryRun ?? false,
502 requestTimeoutMs: parseRequestTimeoutFlag(globals.requestTimeout),
503 };
504}
505
506/**
507 * Parse the `--request-timeout <seconds>` flag value into milliseconds.

Callers 1

createProjectCommandFunction · 0.70

Calls 2

localValidationErrorFunction · 0.70
parseRequestTimeoutFlagFunction · 0.70

Tested by

no test coverage detected