Skip to content
Browse files

Clean up find-clojar

  • Loading branch information...
1 parent f83596c commit adb4afdaa4b510befed7026c53abc8fd1059fe37 @purcell purcell committed with Licenser
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/leiningen/add.clj
View
17 src/leiningen/add.clj
@@ -38,14 +38,15 @@
(cons [(symbol artifact) version] deps))))
(defn find-clojar [what]
- (let [p (re-pattern what)]
- (let [[group artifac] (if (= -1 (.indexOf what "/")) [what what] (next (re-find #"^([^/]+)/(.+)$" what)))]
- (doall (filter
- (fn [{artifact-id :artifact-id group-id :group-id}]
- (and
- (= artifact-id artifac)
- (= group-id group)))
- (read-clj (str *lein-dir* "/clojars")))))))
+ (let [[group artifact] (if-let [match (re-find #"^([^/]+)/(.+)$" what)]
+ (next match)
+ [what what])]
+ (->> (read-clj (str *lein-dir* "/clojars"))
+ (filter
+ (fn [{artifact-id :artifact-id group-id :group-id}]
+ (and
+ (= artifact-id artifact)
+ (= group-id group)))))))
(defn choose-from-numbered-list-if-multiple
"Return first item immediately if there is only one, otherwise prompt the user

0 comments on commit adb4afd

Please sign in to comment.
Something went wrong with that request. Please try again.