utils: Add run-seq
authorJoseph Nuthalapati <njoseph@riseup.net>
Fri, 26 Feb 2021 14:59:56 +0000 (20:29 +0530)
committerJoseph Nuthalapati <njoseph@riseup.net>
Fri, 26 Feb 2021 14:59:56 +0000 (20:29 +0530)
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
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]))))