📚 Update script metadata and add argument parsing to howto.ts

This commit is contained in:
2026-04-12 13:56:20 +08:00
parent 5a95e619dd
commit e216014d27
2 changed files with 26 additions and 7 deletions

View File

@@ -153,12 +153,12 @@
}, },
"howto.ts": { "howto.ts": {
"script_name": "howto.ts", "script_name": "howto.ts",
"script_length": 821, "script_length": 1225,
"script_sha256": "184a8887383342c7aa56adf9d68f1ab87e14cabf2461e9445c1dc975cdc6407f", "script_sha256": "97b7f0efd97b774c70000a5cb56f9115df0e9473cc2018b0404f7556bdba0e83",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/howto.ts", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/howto.ts",
"single_script_file": true, "single_script_file": true,
"publish_time": 1775973075081, "publish_time": 1775973075081,
"update_time": 1775973075081 "update_time": 1775973377013
}, },
"init-cheatsheet.ts": { "init-cheatsheet.ts": {
"script_name": "init-cheatsheet.ts", "script_name": "init-cheatsheet.ts",

View File

@@ -1,10 +1,29 @@
#!/usr/bin/env runts -- --allow-all #!/usr/bin/env runts -- --allow-all
import {log, ProcessBar,} from "https://script.hatter.ink/@67/deno-commons-mod.ts"; import {parseArgs} from "jsr:@std/cli/parse-args";
import {exit, log, ProcessBar,} from "https://script.hatter.ink/@67/deno-commons-mod.ts";
import {howto} from "https://script.hatter.ink/@1/deno-ai-mod.ts"; import {howto} from "https://script.hatter.ink/@1/deno-ai-mod.ts";
async function main() { async function main() {
const message = prompt("Input your message: "); const flags = parseArgs(Deno.args, {
boolean: ["help"],
alias: {
h: "help",
},
});
if (flags.help) {
console.log(`howto.ts
howto.ts --help - show help
howto.ts 'MESSAGE' - generate command line for MESSAGE
`);
exit(0);
}
const message = (flags._)
? flags._.join(" ")
: prompt("Input your message: ");
if (!message) { if (!message) {
throw new Error("Message is required"); throw new Error("Message is required");
} }
@@ -21,5 +40,5 @@ main().catch((err) => {
process.exit(0); process.exit(0);
}).then(() => process.exit(0)); }).then(() => process.exit(0));
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260412T135106+08:00.MEQCICWC9h53VEbG8dkDhZRg // @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260412T135613+08:00.MEUCIQDbJGYgxtAv1d6Vrmyj
// LBcxOktVwEDhnmlQU0MDXiCEAiAB3frJ/GSnacJJ6FXmljy8NmL9kFbqg6hBJUn49QOOYA== // vQDEJGFUuZuH1UQOYQhWRzN69wIgS8tw92nMpF5TLQy/qS4uk7w7d8iY8rmT6DR+V3jg0lM=