Handle missing --csv/--demo option with cond->

This commit is contained in:
Ben Sturmfels 2025-09-20 01:12:59 +10:00
parent 7c3b1b9864
commit d0565f794f
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0

View file

@ -74,9 +74,9 @@
"Run the CLI interface." "Run the CLI interface."
[& args] [& args]
(let [{:keys [options errors summary]} (parse-opts args cli-options) (let [{:keys [options errors summary]} (parse-opts args cli-options)
errors (if-not (or (contains? options :csv) (contains? options :demo)) no-csv-or-demo? (not (or (contains? options :csv) (contains? options :demo)))
(conj errors "Please provide a CSV file with \"--csv FILE\" or try \"--demo\"") errors (cond-> errors
errors)] no-csv-or-demo? (conj "Please provide a CSV file with \"--csv FILE\" or try \"--demo\""))]
(when (:help options) (when (:help options)
(println summary) (println summary)
(System/exit 0)) (System/exit 0))