(
flag: string,
raw: string,
value: number,
bounds: { min?: number; max?: number },
)
| 64 | } |
| 65 | |
| 66 | function enforceRange( |
| 67 | flag: string, |
| 68 | raw: string, |
| 69 | value: number, |
| 70 | bounds: { min?: number; max?: number }, |
| 71 | ): void { |
| 72 | if (bounds.min !== undefined && value < bounds.min) { |
| 73 | errorBox(`Invalid ${flag}`, `Got "${raw}". Minimum is ${bounds.min}.`); |
| 74 | process.exit(1); |
| 75 | } |
| 76 | if (bounds.max !== undefined && value > bounds.max) { |
| 77 | errorBox(`Invalid ${flag}`, `Got "${raw}". Maximum is ${bounds.max}.`); |
| 78 | process.exit(1); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | /** Parse an enum-typed flag against a closed set of allowed values. */ |
| 83 | export function parseEnumFlag<T extends string>( |
no test coverage detected