32 lines
808 B
TypeScript
Executable File
32 lines
808 B
TypeScript
Executable File
#!/usr/bin/env runts --
|
|
|
|
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, {
|
|
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>");
|
|
Deno.exit(0);
|
|
}
|
|
|
|
let input;
|
|
if (flags.value) {
|
|
input = flags.value;
|
|
} else {
|
|
input = new TextDecoder().decode(await toArrayBuffer(Deno.stdin.readable));
|
|
}
|
|
const encoded = decodeURIComponent(input);
|
|
|
|
console.log(encoded);
|
|
|
|
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260122T235929+08:00.MEUCIQDtNpI/a8OTsQtqz+C8
|
|
// XpN1KDs8cDssZCFyRzhqQab3nwIgS7XiDm8mHvwuxSAGOcxGQKd76laaOr1qNdAUP92DRuY=
|