]>
Commit | Line | Data |
---|---|---|
ec37ad05 | 1 | (ns utils |
66364757 JN |
2 | (:require [lib :refer [expand-home run-cmd]] |
3 | [babashka.process :refer [process]])) | |
ec37ad05 JN |
4 | |
5 | (defn run-seq | |
6 | "Run a sequence of shell commands on a sequence of arguments. | |
7 | ||
8 | Examples: | |
9 | ||
10 | 1. Play and delete each video from a folder | |
11 | ls | bb -i '(run-seq [\"mpv\" \"rm\"] *input*)' | |
12 | " | |
13 | [commands arguments] | |
14 | (doseq [argument arguments | |
15 | command commands] | |
16 | (println (run-cmd [command argument])))) | |
66364757 JN |
17 | |
18 | (defn run-task-in-cwd | |
19 | "Run a bb task from this repository in the current working directory." | |
20 | [task] | |
21 | (let [current-dir (System/getenv "PWD") | |
22 | babashka-scripts-dir (expand-home "~/dev/babashka-scripts/")] | |
23 | (print (-> (process ["bb" task current-dir] {:dir babashka-scripts-dir}) | |
24 | :out | |
25 | slurp)))) |