(command: Command)
| 484 | } |
| 485 | |
| 486 | function 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. |
no test coverage detected