A fast, local-first "redirection engine" for !bang users with a few extra features ^-^
1import { bangs } from "./bang.ts";
2
3/* Developer script that converts ./bang.ts' array to hashmap.
4 * In your terminal of choice enter: cd src && bun .\hashbanggen.ts && cd ../
5 * If you should happen to enjoy PowerShell: cd src; bun .\hashbanggen.ts; cd ../
6 * */
7
8const hashbang: {
9 [key: string]: {
10 c?: string;
11 d: string;
12 r: number;
13 s: string;
14 sc?: string;
15 t: string;
16 u: string;
17 };
18} = {};
19for (const bang of bangs) {
20 hashbang[bang.t] = bang;
21}
22
23Bun.write(
24 "./src/hashbang.ts",
25 `export const bangs: {[key: string]: ({c?:string, d: string, r: number, s:string, sc?: string, t: string, u: string })} = ${JSON.stringify(hashbang)};`,
26);