]> njoseph.me Git - babashka-scripts.git/blobdiff - utils.clj
utils: Add run-seq
[babashka-scripts.git] / utils.clj
index 38b9b7491b736a6a97e1004975dafe627d1674f4..c3cdf5ac50022c968bc99eee99e60f2ebd036196 100644 (file)
--- a/utils.clj
+++ b/utils.clj
          ["git" "pull" "--rebase"]
          ["git" "checkout" "-"]
          ["git" "rebase" "master"]])))))
+
+(defn run-seq
+  "Run a sequence of shell commands on a sequence of arguments.
+
+  Examples:
+
+  1. Play and delete each video from a folder
+     ls | bb -i '(run-seq ["mpv" "rm"] *input*)'
+  "
+  [commands arguments]
+  (doseq [argument arguments
+          command commands]
+    (println (run-cmd [command argument]))))