X-Git-Url: https://njoseph.me/gitweb/babashka-scripts.git/blobdiff_plain/0b0a16bdc1598bc64f3cc4ac8195865525b2e9f2..66364757cbb0f829838573b642ccdacce9a1a726:/scripts/utils.clj diff --git a/scripts/utils.clj b/scripts/utils.clj index 8ea7664..1de2099 100644 --- a/scripts/utils.clj +++ b/scripts/utils.clj @@ -1,5 +1,6 @@ (ns utils - (:require [lib :refer [run-cmd]])) + (:require [lib :refer [expand-home run-cmd]] + [babashka.process :refer [process]])) (defn run-seq "Run a sequence of shell commands on a sequence of arguments. @@ -13,3 +14,12 @@ (doseq [argument arguments command commands] (println (run-cmd [command argument])))) + +(defn run-task-in-cwd + "Run a bb task from this repository in the current working directory." + [task] + (let [current-dir (System/getenv "PWD") + babashka-scripts-dir (expand-home "~/dev/babashka-scripts/")] + (print (-> (process ["bb" task current-dir] {:dir babashka-scripts-dir}) + :out + slurp))))