diff --git a/README.md b/README.md index af3fe62..53afc6b 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,6 @@ -# ludus-repl +# A command-line version of Ludus +A Bun-driven, JS-based, command-line version of Ludus. -To install dependencies: +Download a MacOS (ARM64) from the releases page, or use NPM to install `@ludus/cli`. -```bash -bun install -``` -To run: - -```bash -bun run index.ts -``` - -This project was created using `bun init` in bun v1.0.20. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. diff --git a/bun.lockb b/bun.lockb index ac05b89..077d641 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/index.ts b/index.ts old mode 100644 new mode 100755 index 0a7daf5..6d9e6a2 --- a/index.ts +++ b/index.ts @@ -1,19 +1,29 @@ -import { listen } from "./listener" -import { run_file } from "./runner" -import { send } from "./sender" - -const help_text = await Bun.file("./help.txt").text() +#! /usr/bin/env bun export async function main() { const cmd = Bun.argv[2] switch (cmd) { - case "listen": { return listen() } - case "send": { return send() } - case "run": { return run_file(Bun.argv[3]) } + 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}") } } +async function help_text() { + const help_text = await Bun.file("./help.txt").text() + console.log(help_text) +} + await main() diff --git a/scratch.ld b/scratch.ld deleted file mode 100644 index 92b010f..0000000 --- a/scratch.ld +++ /dev/null @@ -1,11 +0,0 @@ -let foo = 42 -let bar = :thing -let baz = #{:a 1, :b 2} - -doc! (add) - -print! ("This is a message from inside Ludus") - -[foo, bar, baz] - -add (1, 2)