Last active
November 26, 2019 22:31
-
-
Save paniq/f15f6ab62ea607f647f4c4a184d10758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env scopes | |
using import console | |
#using import ...conspire.module | |
let source-path argc argv = (script-launch-args) | |
# transform command line to symbolic list | |
let cmd = | |
fold (cmd = '()) for i in (rrange 0 argc) | |
let arg = (argv @ i) | |
let str = (string arg) | |
let val = | |
if (i == 0) `[(Symbol str)] | |
else `str | |
cons val cmd | |
# build scope with which we're going to evaluate commands | |
let repl-scope = | |
do | |
inline test-repl () | |
print "REPL active" | |
# must keep sugar support | |
indirect-let list-handler-symbol | |
locals; | |
let scope = | |
repl-scope | |
# use the line below to prepend your symbols to existing globals | |
#.. repl-scope | |
globals; | |
# if no shell command has been issued, enter REPL console | |
if (cmd == '()) | |
print "Conspire REPL" | |
read-eval-print-loop scope false | |
.. cache-dir "/conspire.history" | |
exit 0 | |
# otherwise evaluate command (which includes compilation) | |
let f = | |
try | |
sc_eval unknown-anchor (list cmd) scope | |
except (err) | |
'format err | |
exit -1 | |
run-stage; | |
# and execute it in the next stage | |
f; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment