Liking cljdoc? Tell your friends :D
Clojure only.

flatland.useful.cli


parse-optsclj

(parse-opts)
(parse-opts args)
(parse-opts default args)

Parse command line args or the provided argument list. Returns a map of keys to vectors of repeated values. Named args begin with --keyname and are mapped to :keyname. Unnamed arguments are mapped to nil or default. Repeated named values can be specified by repeating a key or by using commas in the value. Single and double dashes are both supported though a single dash followed by word characters without internal dashes or an equal sign is assumed to be single character argument flags and are split accordingly.

Example: (parse-opts ["foo" "-vD" "bar" "-no-wrap" "-color=blue,green" "--style=baroque" "-color=red"]) => {:style ["baroque"], :color ["blue" "green" "red"], :no-wrap [""], :D [""], :v [""], nil ["foo" "bar"]}

Parse command line args or the provided argument list. Returns a map of keys to
vectors of repeated values. Named args begin with --keyname and are mapped to
:keyname. Unnamed arguments are mapped to nil or default. Repeated named values can be
specified by repeating a key or by using commas in the value. Single and double dashes
are both supported though a single dash followed by word characters without internal
dashes or an equal sign is assumed to be single character argument flags and are split
accordingly.

Example:
  (parse-opts ["foo" "-vD" "bar" "-no-wrap" "-color=blue,green" "--style=baroque" "-color=red"])
  => {:style ["baroque"], :color ["blue" "green" "red"], :no-wrap [""], :D [""], :v [""], nil ["foo" "bar"]}
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close