Create a gist now

Instantly share code, notes, and snippets.

;; 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