all repos — momix @ 9f32f2cdcf6da96968a218122ffa5a5a9150d36a

A CLI tool to manage recipes for Thermomix

commands/list.ts (view raw)

 1import { Table } from "@cliffy/table";
 2import type { DatabaseSync } from "node:sqlite";
 3import { getRecipesList } from "../services.ts";
 4
 5export default (db: DatabaseSync) => {
 6  const recipes = getRecipesList(db);
 7  const cells = recipes.map((recipe) => [
 8    recipe.id as string,
 9    recipe.name as string,
10    recipe.url as string,
11    recipe.createdAt as string,
12  ]);
13  const table = new Table(["ID", "Name", "URL", "Created At"], ...cells);
14  console.log(table.border().toString());
15};