32 lines
797 B
TypeScript
Executable File
32 lines
797 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.ts");
|
|
console.log("decode-uri.ts --value <value>");
|
|
exit(0);
|
|
}
|
|
|
|
let input;
|
|
if (flags.value) {
|
|
input = flags.value;
|
|
} else {
|
|
input = new TextDecoder().decode(await stdinToArrayBuffer());
|
|
}
|
|
const encoded = decodeURI(input);
|
|
|
|
console.log(encoded);
|
|
|
|
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260211T225506+08:00.MEUCIDfr8u5mUsFF99o/bljU
|
|
// QRarosqW3mkPVLil3xKqm9xbAiEAlE6HABKWVyN/vEIzW4H18Yz3nsoD9O+WlrvhoOzoDGk=
|