ludus-repl/index.ts

30 lines
715 B
TypeScript
Raw Permalink Normal View History

2023-12-27 03:34:43 +00:00
#! /usr/bin/env bun
export async function main() {
const cmd = Bun.argv[2]
switch (cmd) {
2023-12-27 03:34:43 +00:00
case "listen": {
const {listen} = await import("./listener")
return listen()
}
case "send": {
const {send} = await import("./sender")
return send ()
}
case "run": {
const {run_file} = await import("./runner")
return run_file(Bun.argv[3])
}
case "help": { return console.log(help_text) }
case "version": { return console.log("0.1.0") }
default: console.log("Usage: ludus {help | version | run | listen | send}")
}
}
2023-12-27 03:34:43 +00:00
async function help_text() {
const help_text = await Bun.file("./help.txt").text()
console.log(help_text)
}
await main()