aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorCalvin Rose <calsrose@gmail.com>2022-08-31 11:54:33 -0500
committerCalvin Rose <calsrose@gmail.com>2022-08-31 11:54:33 -0500
commitb75458cee6375e70cdc9f227228a7269c2e10103 (patch)
tree9e742a47e1c83b0e2b2f18f820625557c6322546 /bin
parentImplement getch on posix. (diff)
Add -d option to janet-netrepl.
Diffstat (limited to 'bin')
-rw-r--r--bin/janet-netrepl10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/janet-netrepl b/bin/janet-netrepl
index dc8af48..aa21e8e 100644
--- a/bin/janet-netrepl
+++ b/bin/janet-netrepl
@@ -41,6 +41,11 @@
:kind :accumulate
:help "Load libraries in the repl as with the janet -l flag"}
+ "dofile"
+ {:short "d"
+ :kind :option
+ :help "Pass in a file to evaluate with dofile for each new environment table"}
+
"single-env"
{:short "s"
:kind :flag
@@ -50,6 +55,7 @@
(unless ap (break))
(def host (ap "host"))
(def port (ap "port"))
+ (def dof (ap "dofile"))
(def files (get ap :default []))
(def libraries (get ap "library" []))
(defn env-make
@@ -57,7 +63,9 @@
(let [e (make-env)]
(each l libraries (merge-module e (require l)))
(each f files (merge-module e (dofile f)))
- (put e :pretty-format "%.20Q")))
+ (put e :pretty-format "%.20Q")
+ (when dof (dofile dof :env e))
+ e))
(if (ap "client")
(netrepl/client host port (ap "client-name"))
(if (ap "single-env")