Skip to content

Commit fcef304

Browse files
author
dnolen
committed
allow direct setting of REPL env & build config via edn
1 parent ae34de7 commit fcef304

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/main/clojure/cljs/cli.clj

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ classpath. Classpath-relative paths have prefix of @ or @/")
159159
(let [target (if (= "node" target) "nodejs" target)]
160160
(assoc-in cfg [:options :target] (keyword target))))
161161

162+
(defn- repl-env-opts-opt
163+
[cfg ropts]
164+
(update cfg :repl-env-options merge (edn/read-string ropts)))
165+
166+
(defn- compile-opts-opt
167+
[cfg copts]
168+
(update cfg :options merge (edn/read-string copts)))
169+
170+
162171
(defn- init-opt
163172
[cfg file]
164173
(update-in cfg [:inits]
@@ -385,13 +394,18 @@ present"
385394
(str "Set optimization level, only effective with "
386395
"-c main option. Valid values are: none, "
387396
"whitespace, simple, advanced")}
388-
389397
["-t" "--target"] {:group ::main&compile :fn target-opt
390398
:arg "name"
391399
:doc
392400
(str "The JavaScript target. Configures environment bootstrap and "
393401
"defaults to browser. Supported values: nodejs, nashorn, "
394-
"webworker, none") }}
402+
"webworker, none") }
403+
["-rf" "--repl-opts"] {:group ::main&compile :fn repl-env-opts-opt
404+
:arg "edn"
405+
:doc (str "Options to configure the repl-env")}
406+
["-cf" "--compile-opts"] {:group ::main&compile :fn compile-opts-opt
407+
:arg "edn"
408+
:doc (str "Options to configure the build")}}
395409
:main
396410
{["-r" "--repl"] {:fn repl-opt
397411
:doc "Run a repl"}

0 commit comments

Comments
 (0)