]> njoseph.me Git - babashka-scripts.git/blobdiff - git-pull-all.clj
Format all Clojure files using zprint
[babashka-scripts.git] / git-pull-all.clj
index a8152d1fac3838ea73699a6c4880a3a18d9578e7..647db21fd52cd8f487bf332d06f3c14f4cb7e451 100755 (executable)
@@ -2,30 +2,28 @@
 
 ; Runs `git pull` on all the git repositories in a directory
 
-(require '[babashka.process :as p]
-         '[clojure.java.io :as io])
+(require '[babashka.process :as p] '[clojure.java.io :as io])
 
 (def default-root ".")
-  
-(defn list-dirs
-  [root]
-  (filter #(.isDirectory %) (.listFiles (io/file root))))
 
-(defn git-pull
-  [dir]
-  (p/process ["git" "-C" dir "pull" "--rebase"]))
+(defn list-dirs [root] (filter #(.isDirectory %) (.listFiles (io/file root))))
+
+(defn git-pull [dir] (p/process ["git" "-C" dir "pull" "--rebase"]))
 
 (when (= *file* (System/getProperty "babashka.file"))
-  (let [root  (get (into [] *command-line-args*) 0 default-root)
-        dirs  (list-dirs root)
+  (let [root (get (into [] *command-line-args*) 0 default-root)
+        dirs (list-dirs root)
         pulls (->> root
                    list-dirs
                    (map git-pull)
                    doall)
-        outputs (map #(->> % p/check :out slurp) pulls)]
-
-        ;; Print corresponding directory name when pulling
-        ;; Skip printing already up to date repos
-       (doseq [[dir out](filter #(not (.contains (second %) "is up to date."))
-                                (map vector dirs outputs))]
-         (println (str dir "\n" out)))))
+        outputs (map #(->> %
+                           p/check
+                           :out
+                           slurp)
+                  pulls)]
+    ;; Print corresponding directory name when pulling
+    ;; Skip printing already up to date repos
+    (doseq [[dir out] (filter #(not (.contains (second %) "is up to date."))
+                        (map vector dirs outputs))]
+      (println (str dir "\n" out)))))