Fix classpath in README

This commit is contained in:
Michiel Borkent 2020-08-26 10:22:45 +02:00
parent 3dedbb3b2d
commit 2f04a63c8c

View file

@ -361,10 +361,12 @@ dynamically:
``` clojure
(require '[babashka.classpath :refer [add-classpath]]
'[clojure.java.shell :refer [sh]])
'[clojure.java.shell :refer [sh]]
'[clojure.string :as str])
(def medley-dep '{:deps {medley {:git/url "https://github.com/borkdude/medley"
:sha "91adfb5da33f8d23f75f0894da1defe567a625c0"}}})
(def cp (:out (sh "clojure" "-Spath" "-Sdeps" (str medley-dep))))
(def cp (-> (sh "clojure" "-Spath" "-Sdeps" (str medley-dep)) :out str/trim))
(add-classpath cp)
(require '[medley.core :as m])
(m/index-by :id [{:id 1} {:id 2}]) ;;=> {1 {:id 1}, 2 {:id 2}}