 
 (defn validate-arg-against-set
   "Validates the passed argument against the expected set."
-  [arg arg-type valid-args]
-  (or (contains? valid-args arg)
-      (str "Invalid " arg-type ". Expected one of " valid-args ". Got '" (left-string arg 40) "'")))
+  [arg arg-name valid-set]
+  (or (contains? valid-set arg)
+      (str "Invalid " arg-name ". Expected one of " valid-set ". Got '" (left-string arg 40) "'")))
 
 (defn justify-style?
   [arg]



(defn validate-fns-pass?
  "Call validate-fn for each arg that has one (and only if the arg was actually passed). Return true if ALL were successful. Prints errors to console.
   NOTE: Return value for validate-fn is boolean (with a twist):
         - true:   validation success
         - false:  validation failed - use standard error message
         - string: validation failed - use this string in place of standard error message"
  [v-arg-defs passed-args]
  (let [validate-arg (fn [v-arg-def]
                       (let [arg-name        (:name v-arg-def)
                             arg-val         (arg-name passed-args)
                             validate-result ((:validate-fn v-arg-def) arg-val)]

                           (false?  validate-result) (log-error "Argument '" arg-name "' validation failed. Expected '" (:type v-arg-def) "'. Got '" (left-string arg-val 40) "'")
                           (string? validate-result) (log-error validate-result)
                           :else                     (log-error "Invalid return from validate-fn: " validate-result))))]
    (->> (select-keys args-with-validators (vec (keys passed-args)))
         (map validate-arg)
         (every? true?))))

