[#837] Add babashka.task System property
This commit is contained in:
parent
5014012bd6
commit
7462d86afd
2 changed files with 8 additions and 2 deletions
|
|
@ -745,8 +745,10 @@ Use bb run --help to show this help output.
|
||||||
ns var-name)] nil])
|
ns var-name)] nil])
|
||||||
run (if (:run-help cli-opts)
|
run (if (:run-help cli-opts)
|
||||||
[(print-run-help) 0]
|
[(print-run-help) 0]
|
||||||
(tasks/assemble-task run
|
(do
|
||||||
(:parallel-tasks cli-opts)))
|
(System/setProperty "babashka.task" (str run))
|
||||||
|
(tasks/assemble-task run
|
||||||
|
(:parallel-tasks cli-opts))))
|
||||||
file (try [[(read-file file)] nil]
|
file (try [[(read-file file)] nil]
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
(error-handler e {:expression expressions
|
(error-handler e {:expression expressions
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,10 @@
|
||||||
(test-utils/with-config '{:tasks {b {:doc "Beautiful docstring"}}}
|
(test-utils/with-config '{:tasks {b {:doc "Beautiful docstring"}}}
|
||||||
(let [s (test-utils/bb nil "doc" "b")]
|
(let [s (test-utils/bb nil "doc" "b")]
|
||||||
(is (= "-------------------------\nb\nTask\nBeautiful docstring\n" s)))))
|
(is (= "-------------------------\nb\nTask\nBeautiful docstring\n" s)))))
|
||||||
|
(testing "system property"
|
||||||
|
(test-utils/with-config '{:tasks {b (System/getProperty "babashka.task")}}
|
||||||
|
(let [s (bb "run" "--prn" "b")]
|
||||||
|
(is (= "b" s)))))
|
||||||
|
|
||||||
(deftest list-tasks-test
|
(deftest list-tasks-test
|
||||||
(test-utils/with-config {}
|
(test-utils/with-config {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue