Skip to content

Commit

Permalink
Move --output parsing logic to ->config
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahTheDuke committed Nov 19, 2024
1 parent ace704a commit d974326
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 2 additions & 6 deletions src/clojure/lazytest/cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@
:parse-fn #(keyword (if (str/starts-with? % ":") (subs % 1) %))
:assoc-fn update-set]
[nil "--output SYMBOL" "Output format. Can be given multiple times. (Defaults to \"nested\".)"
:parse-fn read-string
:assoc-fn (fn [args k v]
(let [output (if (qualified-symbol? v)
v
(symbol "lazytest.reporters" (name v)))]
(update-vec args k output)))]
:parse-fn symbol
:assoc-fn update-vec]
[nil "--md FILE" "Run doctests for given markdown file. Can be given multiple times."
:parse-fn io/file
:assoc-fn update-vec]
Expand Down
3 changes: 1 addition & 2 deletions src/clojure/lazytest/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
(resolve-reporter (var-get r))
(throw (ex-info (str "Cannot find reporter: " reporter)
{:reporter reporter})))
(symbol? reporter) (throw (ex-info (str "Cannot find reporter: " reporter)
{:reporter reporter}))
(symbol? reporter) (resolve-reporter (symbol "lazytest.reporters" (name reporter)))
(sequential? reporter) (->> (flatten reporter)
(map resolve-reporter)
(apply combine-reporters))
Expand Down

0 comments on commit d974326

Please sign in to comment.