From 0f268de9c98925428bdae49b697082c4178bebb7 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 12 Apr 2026 00:45:45 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Update=20script=20metadata=20and?= =?UTF-8?q?=20enhance=20cheatsheet=20generation=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-meta-v2.json | 6 +++--- single-scripts/update-cheatsheet.ts | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/script-meta-v2.json b/script-meta-v2.json index db530a8..1f16ea8 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -340,12 +340,12 @@ }, "update-cheatsheet.ts": { "script_name": "update-cheatsheet.ts", - "script_length": 2439, - "script_sha256": "bbc770f85c80d26399ee7f8bd891b856e4c713bdc5f91756966015957d91ceb2", + "script_length": 2927, + "script_sha256": "a7d02932f1684134b3123a757f517614000bbecfd722967345e49eb718688a63", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/update-cheatsheet.ts", "single_script_file": true, "publish_time": 1775925235458, - "update_time": 1775925277732 + "update_time": 1775925939859 }, "upper.ts": { "script_name": "upper.ts", diff --git a/single-scripts/update-cheatsheet.ts b/single-scripts/update-cheatsheet.ts index 1af3799..4128baa 100755 --- a/single-scripts/update-cheatsheet.ts +++ b/single-scripts/update-cheatsheet.ts @@ -1,6 +1,6 @@ #!/usr/bin/env -S deno run -A -import { parse } from "jsr:@std/yaml"; +import {parse} from "jsr:@std/yaml"; import { existsPath, exit, @@ -37,6 +37,22 @@ async function main(): Promise { }); await writeStringToFile("meta.json", JSON.stringify(metas, null, 4)); + + let md = []; + md.push("# cheatsheet"); + md.push(""); + + md.push("| Name | Alias | URL | Description |"); + md.push("| ----- | ----- | ----- | ----- |"); + for (const meta of metas) { + md.push( + `| ${meta.name} | ${ + meta.aliases ? meta.aliases : "-" + } | [${meta.name}/CHEATSHEET.md](${meta.name}/CHEATSHEET.md) | ${meta.description} |`, + ); + } + md.push(""); + await writeStringToFile("README.md", md.join("\n")); } interface CheatSheetMeta {