make *command-line-args* available to REPL

This commit is contained in:
Bob 2024-05-25 18:08:06 -04:00
parent 7853d69474
commit a02d775fc8
No known key found for this signature in database
2 changed files with 9 additions and 3 deletions

View file

@ -1021,7 +1021,8 @@ Use bb run --help to show this help output.
doc (print-doc sci-ctx command-line-args)
describe?
[(print-describe) 0]
repl [(repl/start-repl! sci-ctx) 0]
repl (sci/binding [core/command-line-args command-line-args]
[(repl/start-repl! sci-ctx) 0])
nrepl [(start-nrepl! nrepl) 0]
uberjar [nil 0]
list-tasks [(tasks/list-tasks sci-ctx) 0]
@ -1069,7 +1070,8 @@ Use bb run --help to show this help output.
clojure [nil (if-let [proc (bdeps/clojure command-line-args)]
(-> @proc :exit)
0)]
:else [(repl/start-repl! sci-ctx) 0]))
:else (sci/binding [core/command-line-args command-line-args]
[(repl/start-repl! sci-ctx) 0])))
1)]
(flush)
(when uberscript

View file

@ -480,7 +480,11 @@
(deftest command-line-args-test
(is (true? (bb nil "(nil? *command-line-args*)")))
(is (= ["1" "2" "3"] (bb nil "*command-line-args*" "1" "2" "3"))))
(is (= ["1" "2" "3"] (bb nil "*command-line-args*" "1" "2" "3")))
(is (str/includes? (test-utils/bb "*command-line-args*" "repl" "--" "1" "2" "3")
"(\"1\" \"2\" \"3\""))
(is (str/includes? (test-utils/bb "*command-line-args*" "--" "1" "2" "3")
"(\"1\" \"2\" \"3\"")))
(deftest constructors-test
(testing "the clojure.lang.Delay constructor works"