#!/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 { const name = prompt("Cheat sheet name:"); if (!name) { log.error("Cheat sheet name is required"); return; } 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")); log.success(`Init ${name} successfully.`); } main().catch((err) => { log.error(err); exit(1); }).then(() => exit(0)); // @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260412T231558+08:00.MEQCIDBfpbEIXFa3AlXQOTqj // FLDofpXRWVxbx0dIyukc6/ZeAiAze9BYBK1rOWa8TXDmW4Yb5NAFvbCBM6LTjOzqjZtztQ==