MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / parseIntFlag

Function parseIntFlag

packages/cli/src/cloud/parsing.ts:27–36  ·  view source on GitHub ↗
(raw: string | undefined, opts: IntFlagOptions)

Source from the content-addressed store, hash-verified

25 * supply their own defaults.
26 */
27export function parseIntFlag(raw: string | undefined, opts: IntFlagOptions): number | undefined {
28 if (raw === undefined) return undefined;
29 if (!INTEGER_RE.test(raw)) {
30 errorBox(`Invalid ${opts.flag}`, `Got "${raw}". Must be an integer${rangeSuffix(opts)}.`);
31 process.exit(1);
32 }
33 const n = Number.parseInt(raw, 10);
34 enforceRange(opts.flag, raw, n, opts);
35 return n;
36}
37
38export interface FloatFlagOptions {
39 flag: string;

Callers 1

parsing.test.tsFile · 0.70

Calls 3

errorBoxFunction · 0.85
rangeSuffixFunction · 0.85
enforceRangeFunction · 0.85

Tested by

no test coverage detected