///
// Print all the commands.
import { commands } from "@/js/commands"
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(" ")
}