Skip to content

Commit

Permalink
Clean up find-clojar
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed Aug 9, 2010
1 parent 3e131a6 commit 4bf1908
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/leiningen/add.clj
Expand Up @@ -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
Expand Down

0 comments on commit 4bf1908

Please sign in to comment.