(name: string, val: number)
| 72 | } |
| 73 | if (width !== undefined && height !== undefined) { |
| 74 | const validateSize = (name: string, val: number) => { |
| 75 | if (val < 512 || val > 2048) { |
| 76 | throw new CLIError(`--${name} must be between 512 and 2048, got ${val}.`, ExitCode.USAGE); |
| 77 | } |
| 78 | if (val % 8 !== 0) { |
| 79 | throw new CLIError(`--${name} must be a multiple of 8, got ${val}.`, ExitCode.USAGE); |
| 80 | } |
| 81 | }; |
| 82 | validateSize('width', width); |
| 83 | validateSize('height', height); |
| 84 | } |