Skip to content

Commit

Permalink
cljs.repl/add-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
mfikes committed May 4, 2018
1 parent 132d3aa commit d68c939
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/clojure/cljs/cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@ present"
sequence of command line flags."
[repl-env & args]
(try
(let [cl (.getContextClassLoader (Thread/currentThread))]
(.setContextClassLoader (Thread/currentThread) (clojure.lang.DynamicClassLoader. cl)))
(let [commands (merged-commands repl-env)]
(if args
(loop [[opt arg & more :as args] (normalize commands args) inits []]
Expand Down
10 changes: 10 additions & 0 deletions src/main/clojure/cljs/repl.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1371,3 +1371,13 @@ str-or-pattern."
(-parse-error repl-env ret *repl-opts*)
ret)
nil *repl-opts*))))))

(defmacro add-lib
[[quote lib] coord]
(try
(require 'clojure.tools.deps.alpha.repl)
(when-let [add-lib (resolve 'clojure.tools.deps.alpha.repl/add-lib)]
(add-lib lib coord))
(catch Exception e
(.printStackTrace e)
nil)))

0 comments on commit d68c939

Please # to comment.