wip [skip ci]
This commit is contained in:
parent
e0dd41d631
commit
ef4969e54c
3 changed files with 26 additions and 8 deletions
|
|
@ -471,11 +471,11 @@ Use -- to separate script command line args from bb command line args.
|
|||
(assoc opts-map :main (first options))))
|
||||
(":do")
|
||||
(let [options (next options)
|
||||
options (into [] (comp (partition-by #(= % ":do"))
|
||||
options (into [] (comp (partition-by #(= % ":__"))
|
||||
(take-nth 2))
|
||||
options)
|
||||
parsed (map parse-opts options)]
|
||||
(assoc opts-map :do parsed))
|
||||
{:do parsed})
|
||||
;; fallback
|
||||
(if (some opts-map [:file :jar :socket-repl :expressions :main])
|
||||
(assoc opts-map
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
{:tasks {:eval-plus {:babashka/args [-e (+ 1 2 3)]}
|
||||
{:paths ["script"]
|
||||
:tasks {:bash {:babashka/invoke {:fn cool-script/bash}}
|
||||
:eval-plus {:babashka/args [-e (apply + (map (fn [i]
|
||||
(Integer/parseInt i))
|
||||
*command-line-args*))]}
|
||||
:tree {:babashka/args [:clojure -Stree]}
|
||||
:count-files {:babashka/process {:args [bash -c "ls | wc -l"]
|
||||
,,,}}
|
||||
:all {:babashka/args [:do :eval-plus
|
||||
:do :tree
|
||||
:do :count-files]}}}
|
||||
:all {:babashka/args [:do :eval-plus 1 2 3
|
||||
:__ :tree
|
||||
:__ :bash "ls | wc -l"]}}}
|
||||
|
|
|
|||
16
test-resources/setup.clj
Normal file
16
test-resources/setup.clj
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
(defn eval-plus [& args]
|
||||
(apply + (map (fn [i]
|
||||
(Integer/parseInt i))
|
||||
*command-line-args*)))
|
||||
|
||||
(defn tree []
|
||||
(babashka.deps/clojure ["-Stree"]))
|
||||
|
||||
|
||||
(defn all [& args]
|
||||
(apply eval-plus args)
|
||||
(tree))
|
||||
|
||||
(defn bash [& args]
|
||||
(babashka.process/process (into ["bash"] args)))
|
||||
|
||||
Loading…
Reference in a new issue