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

Function parseFlag

src/commands/project.ts:469–484  ·  view source on GitHub ↗
(raw: string | undefined, flagName: string)

Source from the content-addressed store, hash-verified

467}
468
469function parseFlag(raw: string | undefined, flagName: string): number | undefined {
470 if (raw === undefined) return undefined;
471 const n = Number(raw);
472 if (!Number.isFinite(n)) {
473 throw ApiError.fromEnvelope({
474 error: {
475 code: 'VALIDATION_ERROR',
476 message: 'Invalid request.',
477 nextAction: `Flag \`--${flagName}\` is invalid: must be an integer.`,
478 requestId: 'local',
479 details: { field: flagName, reason: 'must be an integer' },
480 },
481 });
482 }
483 return n;
484}
485
486function resolveCommonOptions(command: Command): CommonOptions {
487 const globals = command.optsWithGlobals() as Partial<CommonOptions> & {

Callers 1

createProjectCommandFunction · 0.85

Calls 1

fromEnvelopeMethod · 0.80

Tested by

no test coverage detected