Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extract yes-or-no-question fn from ask-for-update

  • Loading branch information...
commit bf1d78077935f01a232b812f1632aa790b0cec42 1 parent 01cd7af
@purcell purcell authored committed
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/leiningen/update.clj
View
9 src/leiningen/update.clj
@@ -15,14 +15,17 @@
[(cons (map (fn [[a v]] (if (= a (symbol artifact)) [a version] [a v])) f) form) false]
[(cons f form) (= f type)])) ['() false] project))))
-(defn ask-for-update [artifact version new-version]
- (print (str "You are currently using "artifact" in version "version". Do you want to update to "new-version"? (y/n)"))
+(defn yes-or-no-prompt [question]
+ (print question " (y/n)")
(flush)
(let [r (chomp (good-read-line))]
(cond
(= r "y") true
(= r "n") false
- :else (recur artifact version new-version))))
+ :else (recur question))))
+
+(defn ask-for-update [artifact version new-version]
+ (yes-or-no-prompt (str "You are currently using "artifact" in version "version". Do you want to update to "new-version"?")))
(defn find-updates [[artifact version]]
(let [res (first (find-clojar (str artifact)))
Please sign in to comment.
Something went wrong with that request. Please try again.