 ;; UTILITY FUNCTIONS
 
 (defn fail
-  "Indicates a failure has occurred."
-  [msg]
+  "Throws an exception indicating a failure has occurred. This exception will
+  be caught and the message printed to stderr."
+  [& args]
+  (throw (ex-info (apply str args) {::failure true})))
+
+
+(defn print-err
+  "Prints the given arguments to stderr and returns false."
+  [& args]
   (binding [*out* *err*]
-    (println msg))
+    (println (apply str args)))
   false)
 
 

    (do (println usage) true)

    action
    (action opts args)

    :else
    (fail
      (str
        (when (seq args)
          (println "Unrecognized arguments:" (str/join " " args) "\n"))
        usage))))


(defn execute

         (parse-command-args options (:specs cmd) arguments)]
     (cond
       errors
       (print-err (str/join \newline errors))

       (and (empty? branch) (= "help" (first arguments)))
       (recur cmd branch
