Skip to content

Commit fa264e3

Browse files
committed
make fast-initial-prompt? accessible to 3rd party REPLs. also make it possible
to show it after -setup by supporting :after-setup as a value. Only show the prompt as soon as possible if the value is explicitly true.
1 parent 3ecbc3b commit fa264e3

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/main/clojure/cljs/cli.clj

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,9 @@ is trying load some arbitrary ns."
298298
(subs repl-ns (count "cljs.repl.")))))
299299

300300
(defn- fast-initial-prompt? [repl-env inits]
301-
(and (empty? inits)
302-
(contains? #{"node"} (repl-name repl-env))))
301+
(boolean
302+
(and (empty? inits)
303+
(contains? #{"node"} (repl-name repl-env)))))
303304

304305
(defn- repl-opt
305306
"Start a repl with args and inits. Print greeting if no eval options were
@@ -316,7 +317,10 @@ present"
316317
renv (apply repl-env (mapcat identity reopts))]
317318
(repl/repl* renv
318319
(assoc (dissoc-entry-point-opts opts)
319-
::repl/fast-initial-prompt? (fast-initial-prompt? repl-env inits)
320+
::repl/fast-initial-prompt?
321+
(or (fast-initial-prompt? repl-env inits)
322+
(::repl/fast-initial-prompt? (repl/repl-options renv)))
323+
320324
:inits
321325
(into
322326
[{:type :init-forms

src/main/clojure/cljs/repl.cljc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@
10591059
(doseq [[unknown-opt suggested-opt] (util/unknown-opts (set (keys opts)) (set/union known-repl-opts cljsc/known-opts))]
10601060
(when suggested-opt
10611061
(println (str "WARNING: Unknown option '" unknown-opt "'. Did you mean '" suggested-opt "'?"))))
1062-
(when fast-initial-prompt?
1062+
(when (true? fast-initial-prompt?)
10631063
(initial-prompt quit-prompt prompt))
10641064
(let [repl-opts (-repl-options repl-env)
10651065
repl-requires (into repl-requires (:repl-requires repl-opts))
@@ -1125,6 +1125,8 @@
11251125
(if-let [merge-opts (:merge-opts (-setup repl-env opts))]
11261126
(merge opts merge-opts)
11271127
opts)))
1128+
_ (when (= :after-setup fast-initial-prompt?)
1129+
(initial-prompt quit-prompt prompt))
11281130
init (do
11291131
(evaluate-form repl-env env "<cljs repl>"
11301132
`(~'set! ~'cljs.core/*print-namespace-maps* true)

0 commit comments

Comments
 (0)