Fix startup time issues
This commit is contained in:
parent
735e807488
commit
4055d42f33
15
README.md
15
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.
|
||||
|
|
26
index.ts
Normal file → Executable file
26
index.ts
Normal file → Executable file
|
@ -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()
|
||||
|
|
11
scratch.ld
11
scratch.ld
|
@ -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)
|
Loading…
Reference in New Issue
Block a user