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/@41/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.20260211T225504+08:00.MEYCIQDKLbuD0sgzk3bG7F20
|
|
// VvDZHp3Eb2Jtf5u7V6vZ3+TtRQIhAIAOTgX9h7pLbT3fTNmkY5tyAQToY2zDaJ+qzRW7OTmh
|