This commit is contained in:
2026-02-11 22:37:32 +08:00
parent 46dc8009c2
commit f40eb40d6b
8 changed files with 62 additions and 54 deletions

View File

@@ -22,6 +22,10 @@ export function osEnv(key: string): string | undefined {
return isDeno() ? Deno.env.get(key) : process.env[key];
}
export function exit(code?: number): never {
isDeno() ? Deno.exit(code) : process.exit(code);
}
export class ProcessOutput {
code: number;
stdout: string;

View File

@@ -18,12 +18,12 @@
},
"build.ts": {
"script_name": "build.ts",
"script_length": 5539,
"script_sha256": "e0e97ed9aabd3aacc5b17573918c956c653bd0d5077f798e4922e2f717f09495",
"script_length": 5461,
"script_sha256": "0db5ab4646a6a58420c781b7742b1f2807bbe04a6c6c78a3bfb59cb0fb8c1cff",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/build.ts",
"single_script_file": true,
"publish_time": 1770564482429,
"update_time": 1770738246894
"update_time": 1770820648012
},
"cal-bun.ts": {
"script_name": "cal-bun.ts",
@@ -37,11 +37,11 @@
"cal.ts": {
"script_name": "cal.ts",
"script_length": 543,
"script_sha256": "31ea1f892e37d35f39c338d8db7ff729080fcd289cd501837a1e2a055294a2fc",
"script_sha256": "f09036b8751de55b5dd274c848790eee9bd718bb7aa0837ffd60916cf79fc786",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/cal.ts",
"single_script_file": true,
"publish_time": 1737306227061,
"update_time": 1770477195740
"update_time": 1770820648011
},
"cmd.ts": {
"script_name": "cmd.ts",
@@ -71,39 +71,39 @@
},
"decode-uri-component.ts": {
"script_name": "decode-uri-component.ts",
"script_length": 808,
"script_sha256": "54e9fd8a9e98c41c0589f65c060b0f69dd2e25e3a19222f0a73dcfc8c96a3ea0",
"script_length": 895,
"script_sha256": "22af6c21359b50e8907ad2f25f5c1e42a0889c2415347cee5f693728f36931bf",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/decode-uri-component.ts",
"single_script_file": true,
"publish_time": 1769010420928,
"update_time": 1769097609468
"update_time": 1770820648012
},
"decode-uri.ts": {
"script_name": "decode-uri.ts",
"script_length": 779,
"script_sha256": "9182f1aa66455b7060c88c4a169eede6d63ea750fee6d29cefaf1baf00abf121",
"script_length": 866,
"script_sha256": "0e529a1df2a6290f48cef047c9670b36434a81784c86e33e93467d1c406fb9c2",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/decode-uri.ts",
"single_script_file": true,
"publish_time": 1769010420927,
"update_time": 1769097609467
"update_time": 1770820648008
},
"encode-uri-component.ts": {
"script_name": "encode-uri-component.ts",
"script_length": 812,
"script_sha256": "617e2c4133460bf989d18aa5621c3d499fb20796362947746558ac5c568b8acd",
"script_length": 895,
"script_sha256": "f93d315d2b26474b1640c5f4ea4ddcb168dae85b9d1da4ed630cf76c0951dd2f",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/encode-uri-component.ts",
"single_script_file": true,
"publish_time": 1769010420927,
"update_time": 1769097609467
"update_time": 1770820648008
},
"encode-uri.ts": {
"script_name": "encode-uri.ts",
"script_length": 779,
"script_sha256": "7a29b8acf53974f15ee03ff7c12324292190744983db85d4339d562e69ef931e",
"script_length": 866,
"script_sha256": "99051fb4754203c685de490cdbc0addd0203b0866cd902f760d6cc3d8a1305c2",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/encode-uri.ts",
"single_script_file": true,
"publish_time": 1769010420927,
"update_time": 1769097609467
"update_time": 1770820648008
},
"git-check.ts": {
"script_name": "git-check.ts",

View File

@@ -6,13 +6,13 @@ import {
execCommandShell,
existsPath,
log,
readFileToString,
stringifyPretty,
term,
uint8ArrayToHexString,
writeStringToFile,
} from "https://script.hatter.ink/@37/deno-commons-mod.ts";
} from "https://script.hatter.ink/@39/deno-commons-mod.ts";
import {parseArgs} from "jsr:@std/cli/parse-args";
import {readFileToString} from "https://global.hatter.ink/script/get/@1/deno-commons-1.6.0-mod.ts";
function handleHelp() {
console.log(term.auto(`Build scripts to bundle and sign.
@@ -181,5 +181,5 @@ async function buildFile(file: string, flags: any) {
await main();
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260210T234339+08:00.MEUCIHmL1NC1x13n9Ulgfi1k
// i6EtW3hEyc4kRuqopxP+zwYUAiEAwp86FypQnoXj7kXIRnkloPh1d2pIu/9o1eszNC5oJW4=
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260211T222821+08:00.MEQCIAweu8hlz6/t/UPWtHzB
// 6fm4DZPTSfP7NBPSjad5qmB9AiAkpgAvpLAD1qKd+Cz0KBJT6GQq30yt1RKEbYtgKEQjHA==

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env runts -- --allow-import --allow-env --allow-run
import {execCommandShell} from "https://script.hatter.ink/@30/deno-commons-mod.ts";
import {execCommandShell} from "https://script.hatter.ink/@39/deno-commons-mod.ts";
// or: cal -A 1 -B 1
await execCommandShell("cal", [-3]);
@@ -12,5 +12,5 @@ await execCommandShell("cal", [-3]);
// });
// const _child = command.spawn();
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260207T231256+08:00.MEUCIQCTZtceCcESJyAW7TG6
// IVRbKr0B2sE74XSEd8/FHcliIQIgESsAWqtcmSaxVl1Qch61o4kqsge+58lcc9zyEeEpJs4=
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260211T222859+08:00.MEUCIQDoiYXzcy6tb7PkZvfX
// mX/V/yHagXha7VmavMQynzUa4gIgPVl9LeWqPZJPVrlcxQrdYxj1LRmBRzc3n1vEMWJI0eE=

View File

@@ -1,20 +1,21 @@
#!/usr/bin/env runts --
#!/usr/bin/env runts -- --allow-import
import {args, exit} from "https://script.hatter.ink/@41/deno-commons-mod.ts";
import {parseArgs} from "jsr:@std/cli/parse-args";
import {toArrayBuffer} from "https://deno.land/std@0.203.0/streams/mod.ts";
const flags = parseArgs(Deno.args, {
const flags = parseArgs(args(), {
boolean: ["help"],
string: ["value"],
alias: {
V: "value"
}
V: "value",
},
});
if (flags.help) {
console.log("echo value | decode-uri-component.ts");
console.log("decode-uri-component.ts --value <value>");
Deno.exit(0);
exit(0);
}
let input;
@@ -27,5 +28,5 @@ const encoded = decodeURIComponent(input);
console.log(encoded);
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260122T235929+08:00.MEUCIQDtNpI/a8OTsQtqz+C8
// XpN1KDs8cDssZCFyRzhqQab3nwIgS7XiDm8mHvwuxSAGOcxGQKd76laaOr1qNdAUP92DRuY=
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260211T223654+08:00.MEQCIFtTTbxi8OppwMqWir2q
// 0UbxQBHhtTORJyhDnU1vUfOTAiA31LMua+CE7wqry2JYMVikX0iE7e4c/gbuLIFj/KszEw==

View File

@@ -1,20 +1,21 @@
#!/usr/bin/env runts --
#!/usr/bin/env runts -- --allow-import
import {args, exit} from "https://script.hatter.ink/@41/deno-commons-mod.ts";
import {parseArgs} from "jsr:@std/cli/parse-args";
import {toArrayBuffer} from "https://deno.land/std@0.203.0/streams/mod.ts";
const flags = parseArgs(Deno.args, {
const flags = parseArgs(args(), {
boolean: ["help"],
string: ["value"],
alias: {
V: "value"
}
V: "value",
},
});
if (flags.help) {
console.log("echo value | decode-uri.ts");
console.log("decode-uri.ts --value <value>");
Deno.exit(0);
exit(0);
}
let input;
@@ -27,5 +28,5 @@ const encoded = decodeURI(input);
console.log(encoded);
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260122T235937+08:00.MEYCIQCpIqJ+E5Rq42txr21z
// 89Hw017aSUwve29PjvR+zFEONAIhAKY8nSJigFTvpp1jr4quCIEdjOyWP/DCkzzi8KrkjvnZ
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260211T223656+08:00.MEUCIQD2Z+EYNFmlGJF1mRwZ
// WtcimdYPCpkEiGWJ2nCoEFZhSAIgIcokRXUdswb+o/tjq098FbaBSRu2xk8t1qgKvBFp3hw=

View File

@@ -1,20 +1,21 @@
#!/usr/bin/env runts --
#!/usr/bin/env runts -- --allow-import
import { parseArgs } from "jsr:@std/cli/parse-args";
import { toArrayBuffer } from "https://deno.land/std@0.203.0/streams/mod.ts";
import {args, exit} from "https://script.hatter.ink/@41/deno-commons-mod.ts";
import {parseArgs} from "jsr:@std/cli/parse-args";
import {toArrayBuffer} from "https://deno.land/std@0.203.0/streams/mod.ts";
const flags = parseArgs(Deno.args, {
const flags = parseArgs(args(), {
boolean: ["help"],
string: ["value"],
alias: {
V: "value"
}
V: "value",
},
});
if (flags.help) {
console.log("echo value | encode-uri-component.ts");
console.log("encode-uri-component.ts --value <value>");
Deno.exit(0);
exit(0);
}
let input;
@@ -27,5 +28,5 @@ const encoded = encodeURIComponent(input);
console.log(encoded);
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260122T235939+08:00.MEQCIAQ5xspL/Z+a19RydUte
// RRZnxP8wJSNLUFycWtQwJBvOAiAzk+43vb8lLiStnvmxQWN68Ddl2Hy5OodwvKxb2YWM4w==
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260211T223656+08:00.MEYCIQDWpN6TPlSUC2reXixQ
// cAsopGtVR7O1eHOZ8yMXhXJamAIhAKHLwiUf97ArNi0fYjQ8pfEkRXA6kfxM41Uj3rgYj1X/

View File

@@ -1,20 +1,21 @@
#!/usr/bin/env runts --
#!/usr/bin/env runts -- --allow-import
import {args, exit} from "https://script.hatter.ink/@41/deno-commons-mod.ts";
import {parseArgs} from "jsr:@std/cli/parse-args";
import {toArrayBuffer} from "https://deno.land/std@0.203.0/streams/mod.ts";
const flags = parseArgs(Deno.args, {
const flags = parseArgs(args(), {
boolean: ["help"],
string: ["value"],
alias: {
V: "value"
}
V: "value",
},
});
if (flags.help) {
console.log("echo value | encode-uri.ts");
console.log("encode-uri.ts --value <value>");
Deno.exit(0);
exit(0);
}
let input;
@@ -27,5 +28,5 @@ const encoded = encodeURI(input);
console.log(encoded);
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260122T235941+08:00.MEQCIHZDqYuoOnswypoEtmy7
// Op3cR/EpGacHSYeOSvZnH6IiAiBr6iTB1eQwlRuHyteapz8xGEh3n7lHC6x2y16d5qCwcQ==
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260211T223656+08:00.MEUCIHhfsF0mbPmh5MylnqPg
// MEXtiFQ3ncpqJcQruOqdUViLAiEA77/M0NfgxlerlG0zjY/r0Etz7fQ0TyqX8B1Qe1iev8Q=