()
| 37 | ]; |
| 38 | |
| 39 | async function promptForQuery(): Promise<string> { |
| 40 | let query = ""; |
| 41 | const line = ""; |
| 42 | |
| 43 | do { |
| 44 | let line = await input({ |
| 45 | message: query ? "> " : "Enter your SQL query (or '.exit'):", |
| 46 | transformer: (input: string) => { |
| 47 | // Highlight SQL keywords |
| 48 | return input |
| 49 | .split(" ") |
| 50 | .map((word) => (sqlKeywords.includes(word.toUpperCase()) ? clc.cyan(word) : word)) |
| 51 | .join(" "); |
| 52 | }, |
| 53 | nonInteractive: false, |
| 54 | }); |
| 55 | line = line.trimEnd(); |
| 56 | |
| 57 | if (line.toLowerCase() === ".exit") { |
| 58 | return ".exit"; |
| 59 | } |
| 60 | |
| 61 | query += (query ? "\n" : "") + line; |
| 62 | } while (line !== "" && !query.endsWith(";")); |
| 63 | return query; |
| 64 | } |
| 65 | |
| 66 | async function mainShellLoop(conn: pg.PoolClient) { |
| 67 | while (true) { |
no test coverage detected
searching dependent graphs…