this repo has no description
1import { select } from "@topcli/prompts";
2import type { AppletRunFunc } from "./Applet.ts";
3import { ExitApplet } from "./applets/Exit.ts";
4import { UnfoldedHexToSonyApplet } from "./applets/UnfoldedHexToSony.ts";
5import { SonyToUnfoldedHexApplet } from "./applets/SonyToUnfoldedHex.ts";
6
7const applets = [SonyToUnfoldedHexApplet, UnfoldedHexToSonyApplet, ExitApplet];
8const appletNames = applets.map((applet) => applet.name);
9const appletsMap = applets.reduce(
10 (map, applet) => map.set(applet.name, applet.runFunc),
11 new Map<string, AppletRunFunc>(),
12);
13
14while (true) {
15 const selectedAppletName = await select("What would you like to do?", {
16 choices: appletNames,
17 });
18 await appletsMap.get(selectedAppletName)!();
19}