Skip to content

Commit

Permalink
* document supported customization
Browse files Browse the repository at this point in the history
  • Loading branch information
swannodette committed Aug 4, 2024
1 parent 786bc0f commit 5b291ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/clojure/cljs/cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ present"

(defn- main-opt
"Call the -main function from a namespace with string arguments from
the command line."
the command line. Can be customized with ::cljs.cli/main fn entry in
the map returned by cljs.repl/IReplEnvOptions."
[repl-env [_ ns & args] cfg]
((::main (repl/repl-options (repl-env)) default-main)
repl-env (merge cfg {:main ns :args args})))
Expand All @@ -450,6 +451,9 @@ present"
(println (help-str repl-env)))

(defn- script-opt
"If no main option was given (compile, repl, main), handles running in
'script' mode. Can be customized with ::cljs.cli/main fn entry in
the map returned by cljs.repl/IReplEnvOptions."
[repl-env [path & args] cfg]
((::main (repl/repl-options (repl-env)) default-main)
repl-env (merge cfg {:script path :args args})))
Expand Down Expand Up @@ -540,6 +544,8 @@ present"
(serve-opt repl-env args cfg)))))

(defn- compile-opt
"Handle the compile flag. Custom compilation is possible by providing
:cljs.cli/compile fn in the map returned by cljs.repl/IReplEnvOptions."
[repl-env [_ ns & args] cfg]
((::compile (repl/-repl-options (repl-env)) default-compile)
repl-env (merge cfg {:args args :ns ns})))
Expand Down

0 comments on commit 5b291ca

Please sign in to comment.