X-Git-Url: https://njoseph.me/gitweb/babashka-scripts.git/blobdiff_plain/cd6a808b48af61f35ea08b9a4a4f225a9b490cd9..HEAD:/utils.clj diff --git a/utils.clj b/utils.clj deleted file mode 100644 index c3cdf5a..0000000 --- a/utils.clj +++ /dev/null @@ -1,29 +0,0 @@ -(ns utils - (:require [lib :refer [run-cmd]] - [clojure.string :as str])) - -(defn git-pull-rebase-branch - "Do git pull and rebase branch with master" - [] - (let [current-branch (str/trim (run-cmd ["git" "branch" "--show-current"]))] - (print (run-cmd ["git" "pull" "--rebase"])) - (when (not (contains? #{"master" "main"} current-branch)) - (run! print - (map run-cmd - '[["git" "checkout" "master"] - ["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]))))