2 ; -*- mode: clojure -*-
4 ; Runs `git pull` on all the git repositories in a directory
6 (require '[babashka.process :as p] '[clojure.java.io :as io])
10 (defn list-dirs [root] (filter #(.isDirectory %) (.listFiles (io/file root))))
12 (defn git-pull [dir] (p/process ["git" "-C" dir "pull" "--rebase"]))
14 (when (= *file* (System/getProperty "babashka.file"))
15 (let [root (get (into [] *command-line-args*) 0 default-root)
26 ;; Print corresponding directory name when pulling
27 ;; Skip printing already up to date repos
28 (doseq [[dir out] (filter #(not (.contains (second %) "is up to date."))
29 (map vector dirs outputs))]
30 (println (str dir "\n" out)))))