File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -158,8 +158,13 @@ WARNING: (We won't make any changes without asking you first.)
158158 (->> (reduce #(str/replace %1 %2 " " ) lib (keys providers))
159159 symbol))
160160
161+ (defn- get-lib-provider [lib]
162+ (if-let [provider (some #(when (re-seq (key %) (str lib)) %) providers)]
163+ provider
164+ (throw (ex-info " Unable to find an appropriate provider" {:lib lib}))))
165+
161166(defn git-http-url [lib]
162- (let [provider (some #( when ( re-seq ( key %) ( str lib)) %) providers )
167+ (let [provider (get- lib-provider lib )
163168 s (clean-lib-str (str lib))]
164169 (case (val provider)
165170 :github (str " https://github.com/" s " .git" )
@@ -171,7 +176,7 @@ WARNING: (We won't make any changes without asking you first.)
171176 :sourcehut (str " https://git.sr.ht/~" s))))
172177
173178(defn git-ssh-url [lib]
174- (let [provider (some #( when ( re-seq ( key %) ( str lib)) %) providers )
179+ (let [provider (get- lib-provider lib )
175180 s (clean-lib-str (str lib))]
176181 (case (val provider)
177182 :github (str " git@github.com:" s " .git" )
@@ -187,7 +192,7 @@ WARNING: (We won't make any changes without asking you first.)
187192 (ensure-git-dir client url)
188193 url)
189194 (catch Exception e
190- (if (re-seq #"^Unable to clone " (ex-message e))
195+ (if (re-seq #"^Unable to " (ex-message e))
191196 (let [url (git-ssh-url lib)]
192197 (ensure-git-dir client url)
193198 url)
Original file line number Diff line number Diff line change 6969 :sourcehut (str " https://git.sr.ht/~" s))))
7070
7171(defn git-ssh-url [lib]
72- (let [provider (some #( when ( re-seq ( key %) ( str lib)) %) providers )
72+ (let [provider (get- lib-provider lib )
7373 s (clean-lib-str (str lib))]
7474 (case (val provider)
7575 :github (str " git@github.com:" s " .git" )
You can’t perform that action at this time.
0 commit comments