// Print all the commands, or a subset.
import { commands } from "@/commands"
export default async function (prefix?: string) {
let cmds = prefix ? await matchingCommands(prefix) : Object.keys(await commands())
return { html: "
" + cmds.map(cmd => `
${cmd}`).join("") + "
" }
}
async function matchingCommands(cmd: string): Promise {
let matched: string[] = []
for (const command of Object.keys(await commands()))
if (command.startsWith(cmd)) matched.push(command)
return matched
}