Print out the vars we did get
This commit is contained in:
parent
2de1824ee9
commit
eaf901c050
@ -179,13 +179,18 @@
|
|||||||
(println msg)
|
(println msg)
|
||||||
(System/exit status))
|
(System/exit status))
|
||||||
|
|
||||||
|
(defn pprint-to-string [o]
|
||||||
|
(with-out-str (clojure.pprint/pprint o)))
|
||||||
|
|
||||||
(defn get-args [keys args]
|
(defn get-args [keys args]
|
||||||
(let [input-opts (parse-opts args cli-opts)
|
(let [input-opts (parse-opts args cli-opts)
|
||||||
opts (into {} (map (partial get-key input-opts) keys))
|
opts (into {} (map (partial get-key input-opts) keys))
|
||||||
missing (filter (fn [k] (not (get opts k))) keys)]
|
missing (filter (fn [k] (not (get opts k))) keys)]
|
||||||
(cond (:help opts) (exit! 0 (println (:summary opts)))
|
(cond (:help opts) (exit! 0 (:summary opts))
|
||||||
(:errors opts) (exit! 1 (println (str/join \newline (:errors opts))))
|
(:errors opts) (exit! 1 (str/join \newline (:errors opts)))
|
||||||
(not (empty? missing)) (exit! 2 (println (str "missing arguments: " (str/join " " (map name missing)))))
|
(not (empty? missing)) (exit! 2 (str "missing arguments: " (str/join " " (map name missing))
|
||||||
|
\newline
|
||||||
|
"available: " (pprint-to-string opts)))
|
||||||
:else opts)))
|
:else opts)))
|
||||||
|
|
||||||
(defn -main [& args]
|
(defn -main [& args]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user