(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"]}cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |