MCPcopy Create free account
hub / github.com/firebase/firebase-tools / promptForQuery

Function promptForQuery

src/commands/dataconnect-sql-shell.ts:39–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37];
38
39async 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
66async function mainShellLoop(conn: pg.PoolClient) {
67 while (true) {

Callers 1

mainShellLoopFunction · 0.85

Calls 1

inputFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…