1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { Command } from "https://esm.town/v/pomdtr/cmdk";
import { zip } from "https://esm.town/v/pomdtr/sql";
import { sqlite } from "https://esm.town/v/std/sqlite?v=6";
export const listTables: Command = async () => {
const res = await sqlite.execute("SELECT name FROM sqlite_master WHERE type='table'");
const tables = zip(res);
return {
type: "list",
list: {
items: tables.map(table => ({
title: table.name,
actions: [
{
title: "Copy Name",
type: "copy",
copy: {
text: table.name,
},
},
],
})),
},
};
};