[#234] *ns* should be controllable set per socket REPL connection
This commit is contained in:
parent
9269f1087f
commit
8f698894f6
3 changed files with 7 additions and 5 deletions
2
sci
2
sci
|
|
@ -1 +1 @@
|
||||||
Subproject commit 641a1d943d8df4f7ffdf0f243dcda0ad54f7bad5
|
Subproject commit 3f448903550feaeb7d752c958f6422a5fde667f7
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
[clojure.tools.reader.reader-types :as r]
|
[clojure.tools.reader.reader-types :as r]
|
||||||
[sci.impl.interpreter :refer [eval-form]]
|
[sci.impl.interpreter :refer [eval-form]]
|
||||||
[sci.impl.parser :as parser]
|
[sci.impl.parser :as parser]
|
||||||
|
[sci.impl.vars :as vars]
|
||||||
[sci.core :as sci]
|
[sci.core :as sci]
|
||||||
[sci.impl.io :as sio]))
|
[sci.impl.io :as sio]))
|
||||||
|
|
||||||
|
|
@ -58,7 +59,7 @@
|
||||||
expr)]
|
expr)]
|
||||||
ret)))
|
ret)))
|
||||||
:need-prompt (or need-prompt (fn [] true))
|
:need-prompt (or need-prompt (fn [] true))
|
||||||
:prompt (or prompt #(sio/printf "%s=> " (-> sci-ctx :env deref :current-ns)))
|
:prompt (or prompt #(sio/printf "%s=> " (vars/current-ns-name)))
|
||||||
:flush (or flush sio/flush)
|
:flush (or flush sio/flush)
|
||||||
:print (or print sio/prn)
|
:print (or print sio/prn)
|
||||||
:caught (or caught repl-caught)))))
|
:caught (or caught repl-caught)))))
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,10 @@
|
||||||
(vars/bindRoot sci/err *err*)
|
(vars/bindRoot sci/err *err*)
|
||||||
|
|
||||||
(defn repl! []
|
(defn repl! []
|
||||||
(start-repl! (init {:bindings {'*command-line-args*
|
(sci/with-bindings {vars/current-ns (vars/->SciNamespace 'user)}
|
||||||
["a" "b" "c"]}
|
(start-repl! (init {:bindings {'*command-line-args*
|
||||||
:env (atom {})})))
|
["a" "b" "c"]}
|
||||||
|
:env (atom {})}))))
|
||||||
|
|
||||||
(defn assert-repl [expr expected]
|
(defn assert-repl [expr expected]
|
||||||
(is (str/includes? (sci/with-out-str
|
(is (str/includes? (sci/with-out-str
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue