"cake versions" with no argument throws null exception
rosejn opened this issue · comments
This patch fixes the error and prints a usage message, but a more general solution for all commands might be better.
diff --git a/src/cake/tasks/clojars.clj b/src/cake/tasks/clojars.clj
index f385d74..5e9e71b 100644
--- a/src/cake/tasks/clojars.clj
+++ b/src/cake/tasks/clojars.clj
@@ -50,14 +50,16 @@
(println "\n\n")))
(defn clojars-versions [library-name]
- (let [response (http-get-text-seq clojars-all-jars-url)]
- (println "\n\nAvailable versions for library: " library-name)
- (println "--------------------------------------------------------------------------------")
- (doseq [entry (filter #(= (first %) (symbol library-name))
- (for [line response]
- (read-string line)))]
- (println " " (first entry) " " (second entry)))
- (println "\n\n")))
+ (if (nil? library-name)
+ (println "No library specified.\n\tUsage: cake versions <library-name>")
+ (let [response (http-get-text-seq clojars-all-jars-url)]
+ (println "\n\nAvailable versions for library: " library-name)
+ (println "--------------------------------------------------------------------------------")
+ (doseq [entry (filter #(= (first %) (symbol library-name))
+ (for [line response]
+ (read-string line)))]
+ (println " " (first entry) " " (second entry)))
+ (println "\n\n"))))
thanks. i just checked in a fix for this for all clojars tasks