Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View validate.clj
1 2 3 4 5 6 7 8 9 10 11 12 13 14
;; Any type of error class, as CLJS uses js/Error
(defn e! [fmt & args]
(throw (AssertionError. (apply format fmt args))))
;; Exception message takes precedence over :validation-msg
["-i" "--input-directory DIR"
:validate-fn #(cond (not (ok-path? %))
(e! "Input directory path %s is malformed" (pr-str %))
 
(let [f (File. %)]
(and (.exists f) (not (.isDirectory f))))
(e! "Input directory %s is not a directory" (pr-str %))
 
:else true)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.