Part data model (#950)

This commit is contained in:
Dax
2025-07-13 17:22:11 -04:00
committed by GitHub
parent 736396fc70
commit 90d6c4ab41
27 changed files with 1447 additions and 965 deletions

View File

@@ -1,6 +1,8 @@
import { z } from "zod"
import { EOL } from "os"
import { NamedError } from "../util/error"
// @ts-ignore
import cliMarkdown from "cli-markdown"
export namespace UI {
const LOGO = [
@@ -76,4 +78,18 @@ export namespace UI {
export function error(message: string) {
println(Style.TEXT_DANGER_BOLD + "Error: " + Style.TEXT_NORMAL + message)
}
export function markdown(text: string): string {
const rendered = cliMarkdown(text, {
width: process.stdout.columns || 80,
firstHeading: false,
tab: 0,
}).trim()
// Remove leading space from each line
return rendered
.split("\n")
.map((line: string) => line.replace(/^ /, ""))
.join("\n")
}
}