From 415cbd0ccdc120bfe95659cbb87e456ba02958aa Mon Sep 17 00:00:00 2001
From: Chris Wanstrath <2+defunkt@users.noreply.github.com>
Date: Tue, 7 Oct 2025 18:42:33 -0700
Subject: [PATCH] wip
---
bin/commands.ts | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/bin/commands.ts b/bin/commands.ts
index c143fc3..c328ac2 100644
--- a/bin/commands.ts
+++ b/bin/commands.ts
@@ -3,6 +3,21 @@
import { commands } from "@/js/commands"
-export default function () {
- return { html: "
" + Object.keys(commands).map(cmd => `
${cmd}`).join("") + "
" }
+export default function (prefix?: string) {
+ let cmds = prefix ? matchingCommands(prefix) : commands
+
+ return { html: "" + Object.keys(cmds).map(cmd => `
${cmd}`).join("") + "
" }
+}
+
+
+function matchingCommands(cmd: string): string {
+ let matched: string[] = []
+ console.log(Object.keys(commands))
+ for (const command of Object.keys(commands)) {
+ console.log("cmd->", command)
+ if (command.startsWith(cmd)) matched.push(command)
+ }
+
+
+ return matched.join(" ")
}
\ No newline at end of file