feat: CLI file execution — 'jolt file.clj [args]' runs a script (binds *command-line-args*/*file*), '-e EXPR' evaluates, '-h' help; fix print/println/pr/prn to space-separate, render collections, and not double-newline

This commit is contained in:
Yogthos 2026-06-04 16:40:04 -04:00
parent 37c8971d41
commit e87f6db10e
3 changed files with 72 additions and 8 deletions

View file

@ -35,10 +35,14 @@ This compiles `src/jolt/*.janet` into a standalone `build/jolt` executable. Requ
## Run
```
build/jolt
build/jolt # start a REPL
build/jolt file.clj [args] # run a Clojure file (binds *command-line-args*)
build/jolt -e EXPR [args] # evaluate EXPR and print the result
build/jolt -h # help
```
Drops into a read-eval-print loop where you can type Clojure expressions:
With no arguments it drops into a read-eval-print loop (multi-line forms are
accumulated until balanced):
```
user=> (+ 1 2)
@ -51,6 +55,14 @@ user=> (fib 10)
55
```
Running a file evaluates its top-level forms:
```
$ echo '(println "hello" (* 6 7))' > hello.clj
$ build/jolt hello.clj
hello 42
```
## Test
```