* §6.6 / M2.1 piece 2 — validate the `--status ` flag client * side. Empty / undefined → no filter. Each token must be a public * status value; unknown tokens fail with VALIDATION_ERROR (exit 5) * before the request hits the wire so a typo like `--status fail` * gets a pointed error includ
(raw: string | undefined)
| 7628 | * gets a pointed error including the accepted set. |
| 7629 | */ |
| 7630 | function validateStatusFilter(raw: string | undefined): void { |
| 7631 | if (raw === undefined || raw === '') return; |
| 7632 | for (const token of raw.split(',')) { |
| 7633 | const trimmed = token.trim(); |
| 7634 | if (trimmed === '') continue; |
| 7635 | if (!PUBLIC_STATUSES.includes(trimmed as CliPublicStatus)) { |
| 7636 | throw localValidationError( |
| 7637 | 'status', |
| 7638 | `must be one of: ${PUBLIC_STATUSES.join(', ')} (comma-separated for multiple)`, |
| 7639 | [...PUBLIC_STATUSES], |
| 7640 | ); |
| 7641 | } |
| 7642 | } |
| 7643 | } |
| 7644 | |
| 7645 | function parseEnumFlag<T extends string>( |
| 7646 | raw: string | undefined, |
no test coverage detected