32 lines
826 B
TypeScript
Executable File
32 lines
826 B
TypeScript
Executable File
#!/usr/bin/env runts -- --allow-import
|
|
|
|
import {args, exit, stdinToArrayBuffer,} from "https://script.hatter.ink/@43/deno-commons-mod.ts";
|
|
import {parseArgs} from "jsr:@std/cli/parse-args";
|
|
|
|
const flags = parseArgs(args(), {
|
|
boolean: ["help"],
|
|
string: ["value"],
|
|
alias: {
|
|
V: "value",
|
|
},
|
|
});
|
|
|
|
if (flags.help) {
|
|
console.log("echo value | decode-uri-component.ts");
|
|
console.log("decode-uri-component.ts --value <value>");
|
|
exit(0);
|
|
}
|
|
|
|
let input;
|
|
if (flags.value) {
|
|
input = flags.value;
|
|
} else {
|
|
input = new TextDecoder().decode(await stdinToArrayBuffer());
|
|
}
|
|
const encoded = decodeURIComponent(input);
|
|
|
|
console.log(encoded);
|
|
|
|
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260211T232941+08:00.MEQCIDtPzUMOd+4U6dqHF2bm
|
|
// IzflFAH5FVCdchUSralaxosHAiAbe3/u4pNe5NBY3Iu5xfnXBtp9znG2/FyZfYmsMone7w==
|