🆕 Add metadata entry for init-cheatsheet.ts script

This commit is contained in:
2026-04-12 01:43:03 +08:00
parent 9f8889d400
commit d87ca12cd4
2 changed files with 58 additions and 0 deletions

View File

@@ -151,6 +151,15 @@
"publish_time": 1737375737613,
"update_time": 1770822121766
},
"init-cheatsheet.ts": {
"script_name": "init-cheatsheet.ts",
"script_length": 1257,
"script_sha256": "dc2a11300fb1c96ff3edaa2ea0c942e95d98e7e3c4f7fa93aa565606d59e6da3",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/init-cheatsheet.ts",
"single_script_file": true,
"publish_time": 1775929369681,
"update_time": 1775929369681
},
"ip.ts": {
"script_name": "ip.ts",
"script_length": 653,

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env runts -- --allow-all
import {
existsPath,
exit,
log,
makeDirectory,
writeStringToFile,
} from "https://script.hatter.ink/@70/deno-commons-mod.ts";
async function main(): Promise<void> {
const name = prompt("Cheat sheet name:");
const repo = prompt("Cheat sheet repo:");
const desc = prompt("Cheat sheet description:");
if (await existsPath(name)) {
log.error(`Path ${name} exists`);
}
const cheatsheetFile = `${name}/CHEATSHEET.md`;
if (await existsPath(cheatsheetFile)) {
log.error(`File ${cheatsheetFile} exists`);
}
await makeDirectory(name);
const md: string[] = [];
md.push(`# ${name}`);
md.push("");
md.push("## Meta");
md.push("");
md.push("```yaml");
md.push(`name: ${name}`);
if (repo) {
md.push(`repo: ${repo}`);
}
md.push(`description: ${desc}`);
md.push("```");
md.push("");
md.push("");
await writeStringToFile(cheatsheetFile, md.join("\n"));
}
main().catch((err) => {
log.error(err);
exit(1);
}).then(() => exit(0));
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260412T014242+08:00.MEUCIDaSrI8WyJa6nyc3Gd5D
// SP/P4BvB3pOKrU9FP7uB/QMAAiEAw/ZuIjxQnOVmSpiP/LRdcvPJlqeAkYaRjoPbMW9Pklg=