(raw: string | undefined, label = "--args")
| 43 | } |
| 44 | |
| 45 | function parseSqlArgs(raw: string | undefined, label = "--args"): unknown[] { |
| 46 | if (!raw) return []; |
| 47 | try { |
| 48 | const parsed = JSON.parse(raw); |
| 49 | if (Array.isArray(parsed)) return parsed; |
| 50 | } catch { |
| 51 | // Fall through to the shared error below. |
| 52 | } |
| 53 | fail(`${label} must be a JSON array`); |
| 54 | } |
| 55 | |
| 56 | function parseStatements(parsed: Record<string, string>): DbExecStatement[] { |
| 57 | if (parsed.statements) { |
no test coverage detected