The second vector of vector seems unnecessary.
Or tools.cli way:
(ns foo.main
(:gen-class)
(:use [clojure.tools.cli :only (cli optional)]))
(defn parse-opts
[args]
(cli args
(optional ["--in-file-name"
".csv input file"
:default "resultset.csv"]
identity)))
(defn -main
[& args]
(let [opts (parse-opts args)]
(println "in-file-name:" (:in-file-name opts))))
It might be verbose but I think it is more descriptive than
with-command-line one.
However, I'd like more documents and examples about tools.cli.
--
Name: OGINO Masanori (荻野 雅紀)
E-mail: masanor...@gmail.com
https://github.com/clojure/tools.cli
https://github.com/clojure/tools.cli/blob/master/src/test/clojure/clojure/tools/cli_test.clj
2011/7/28 OGINO Masanori <masanor...@gmail.com>:
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
BTW some functions seems not to be public API though they are public.
Why they are not separated by defn- or specific namespace like
clojure.tools.cli.internals?
:dependencies [[org.clojure/clojure "1.2.1"]
[org.clojure/tools.cli "0.1.0"]]
no worries, glad they help.
> BTW some functions seems not to be public API though they are public.
> Why they are not separated by defn- or specific namespace like
> clojure.tools.cli.internals?
no reason other than its a small lib with a handful of functions...