     (println "Usage: repo-path backup-path (:repair|:report)")
     (let [[repo backup-dir action] args]
       (doseq [md (find-bad-metadata repo)]
-        (when (= ":repair" action)
-          (repair-metadata (io/file backup-dir) md))
         (prn (-> md
                  (dissoc :version-dirs :metadata)
-                 (update :file (memfn getAbsolutePath))))))))
+                 (update :file (memfn getAbsolutePath))))
+        (when (= ":repair" action)
+          (repair-metadata (io/file backup-dir) md))))))

                                           (not (.exists (io/file dir "maven-metadata.xml"))))]
                             dir)
              versions (set (map (memfn getName) version-dirs))
              missing-versions? (not= versions (set (.getVersions (.getVersioning metadata))))
              invalid-sums? (not (futil/valid-sums? f))]
        :when (or missing-versions? invalid-sums?)]
    {:file              f

                  [file (futil/sum-file file :sha1) (futil/sum-file file :md5)]))))

(defn repair-versions [{:keys [file metadata version-dirs]}]
  (let [versioning (get-versioning metadata)
        sorted-dirs (sort-by #(.lastModified %) version-dirs)]
    ;; remove existing versions, then write dir versions in dir creation order
    (run! #(.removeVersion versioning %) (into [] (.getVersions versioning)))
    (run! #(.addVersion versioning %) (map (memfn getName) sorted-dirs))
    ;; set release to latest !snapshot
    (.setRelease versioning
                 (when-let [v (->> sorted-dirs
                                   (filter #(not (.endsWith (.getName %) "SNAPSHOT")))
                                   last)]
                   (.getName v)))
    ;; set lastUpdated to latest version
    (.setLastUpdated versioning (.format date-formatter
                                         (-> sorted-dirs last .lastModified Date.)))
