          (parse-command-args options (:specs cmd) arguments)]
      (cond
        errors
-       (fail (str/join \newline errors))
+       (print-err (str/join \newline errors))
 
        (and (empty? branch) (= "help" (first arguments)))
        (recur cmd branch

(ns mvxcvi.directive
  (:require
    [clojure.string :as str]
    [clojure.tools.cli :as cli]))


;; UTILITY FUNCTIONS

(defn fail
  "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 (apply str args)))
  false)


