Fix #1414: preserve metadata on exec task function argument map
This commit is contained in:
parent
8269a632c0
commit
9ed3cb6a31
4 changed files with 22 additions and 5 deletions
|
|
@ -9,6 +9,7 @@ A preview of the next release can be installed from
|
||||||
|
|
||||||
- Add `run-test` and `run-test-var` to `clojure.test`
|
- Add `run-test` and `run-test-var` to `clojure.test`
|
||||||
- Compile distributed uberjar using GraalVM, fixes `babashka.process/exec` for Nix
|
- Compile distributed uberjar using GraalVM, fixes `babashka.process/exec` for Nix
|
||||||
|
- [#1414](https://github.com/babashka/babashka/issues/1414): preserve metadata on exec task function argument map
|
||||||
|
|
||||||
## 1.0.165 (2022-11-01)
|
## 1.0.165 (2022-11-01)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,11 @@
|
||||||
(:org.babashka/cli the-var-meta)
|
(:org.babashka/cli the-var-meta)
|
||||||
(:org.babashka/cli ct)
|
(:org.babashka/cli ct)
|
||||||
extra-opts)
|
extra-opts)
|
||||||
opts (babashka.cli/parse-opts *command-line-args* cli-opts)
|
|
||||||
task-exec-args (:exec-args ct)
|
task-exec-args (:exec-args ct)
|
||||||
cli-exec-args (:exec-args cli-opts)
|
cli-exec-args (:exec-args cli-opts)
|
||||||
opts (babashka.cli/merge-opts cli-exec-args task-exec-args opts)]
|
exec-args {:exec-args (babashka.cli/merge-opts cli-exec-args task-exec-args)}
|
||||||
|
cli-opts (babashka.cli/merge-opts exec-args cli-opts)
|
||||||
|
opts (babashka.cli/parse-opts *command-line-args* cli-opts)]
|
||||||
(the-var opts))"
|
(the-var opts))"
|
||||||
(random-uuid)
|
(random-uuid)
|
||||||
(pr-str extra-opts)
|
(pr-str extra-opts)
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,6 @@
|
||||||
(defn exec-test
|
(defn exec-test
|
||||||
{:org.babashka/cli {:coerce {:bar :keyword}}}
|
{:org.babashka/cli {:coerce {:bar :keyword}}}
|
||||||
[m]
|
[m]
|
||||||
(prn m))
|
(if (:meta m)
|
||||||
|
(prn (meta m))
|
||||||
|
(prn m)))
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
[babashka.test-utils :as u]
|
[babashka.test-utils :as u]
|
||||||
[cheshire.core :as cheshire]
|
[cheshire.core :as cheshire]
|
||||||
[clojure.edn :as edn]
|
[clojure.edn :as edn]
|
||||||
[clojure.test :as t :refer [deftest is]]))
|
[clojure.test :as t :refer [deftest is testing]]))
|
||||||
|
|
||||||
(defn bb [& args]
|
(defn bb [& args]
|
||||||
(apply u/bb nil args))
|
(apply u/bb nil args))
|
||||||
|
|
@ -33,4 +33,17 @@
|
||||||
"{:deps {}
|
"{:deps {}
|
||||||
:tasks {foo {:task (exec 'babashka.exec-test/exec-test)}}}"
|
:tasks {foo {:task (exec 'babashka.exec-test/exec-test)}}}"
|
||||||
(is (= {:foo [1], :bar :yeah}
|
(is (= {:foo [1], :bar :yeah}
|
||||||
(edn/read-string (bb "-cp" "test-resources" "run" "foo" "--foo" "1" "--bar" "yeah"))))))
|
(edn/read-string (bb "-cp" "test-resources" "run" "foo" "--foo" "1" "--bar" "yeah")))))
|
||||||
|
(testing "task exec args"
|
||||||
|
(u/with-config
|
||||||
|
"{:deps {}
|
||||||
|
:tasks {foo {:exec-args {:foo :bar}
|
||||||
|
:task (exec 'babashka.exec-test/exec-test)}}}"
|
||||||
|
(is (= {:foo :bar, :bar :yeah}
|
||||||
|
(edn/read-string (bb "-cp" "test-resources" "run" "foo" "--bar" "yeah"))))))
|
||||||
|
(testing "meta"
|
||||||
|
(u/with-config
|
||||||
|
"{:deps {}
|
||||||
|
:tasks {foo {:task (exec 'babashka.exec-test/exec-test)}}}"
|
||||||
|
(is (= #:org.babashka{:cli {:args ["dude"]}}
|
||||||
|
(edn/read-string (bb "-cp" "test-resources" "run" "foo" "dude" "--bar" "yeah" "--meta")))))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue