Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make cli/summarize public

This allows users to call our summarize fn from within their custom
:summary-fn in case they wish to insert our summary into a template,
while still having access to the underlying spec in a few other places
in their :summary-fn.
  • Loading branch information...
commit c187e11df44717ed4f8a63fd6ca91e1eb9b76985 1 parent b267fd9
@guns guns authored
View
2  src/main/clojure/clojure/tools/cli.clj
@@ -345,7 +345,7 @@
[m (conj errors (str "Unknown option: " (pr-str opt)))]))
[(default-option-map specs) []] tokens))
-(defn- summarize
+(defn summarize
"Reduce options specs into a options summary for printing at a terminal."
[specs]
(let [all-boolean? (every? (comp not :required) specs)
View
5 src/test/clojure/clojure/tools/cli_test.clj
@@ -1,7 +1,7 @@
(ns clojure.tools.cli-test
(:use [clojure.string :only [join split]]
[clojure.test :only [deftest is testing]]
- [clojure.tools.cli :as cli :only [cli parse-opts]]))
+ [clojure.tools.cli :as cli :only [cli parse-opts summarize]]))
(testing "syntax"
(deftest should-handle-simple-strings
@@ -278,9 +278,6 @@
[:long-opt "--verbose"]])
[{:alpha true :verbose 3} []])))))
-(def summarize
- #'cli/summarize)
-
(deftest test-summarize
(testing "summarizes options"
(is (= (summarize (compile-option-specs
Please sign in to comment.
Something went wrong with that request. Please try again.