aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChouser <chouser@n01se.net>2009-06-03 18:45:30 +0000
committerChouser <chouser@n01se.net>2009-06-03 18:45:30 +0000
commitffa868411cda6c617105b52b4f6f9e0f37ee8c24 (patch)
tree83ffe8ac42b97a4f6611411e49c3cf73a9aad3ee /src
parent2018d13849da8aef92710e50eed2b29017950ead (diff)
command-line: default options didn't actually work. fixed.
Diffstat (limited to 'src')
-rw-r--r--src/clojure/contrib/command_line.clj7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/clojure/contrib/command_line.clj b/src/clojure/contrib/command_line.clj
index 96f10ac5..8a179c1d 100644
--- a/src/clojure/contrib/command_line.clj
+++ b/src/clojure/contrib/command_line.clj
@@ -22,9 +22,12 @@
(conj spec '[help? h?]))
sym syms]
[(re-find #"^.*[^?]" (str sym))
- {:sym (str (first syms)) :default default}]))]
+ {:sym (str (first syms)) :default default}]))
+ defaults (into {} (for [[_ {:keys [default sym]}] key-data
+ :when default]
+ [sym default]))]
(loop [[argkey & [argval :as r]] (if (seq args) args ["--help"])
- cmdmap {:cmdspec cmdspec rest-str []}]
+ cmdmap (assoc defaults :cmdspec cmdspec rest-str [])]
(if argkey
(let [[_ & [keybase]] (re-find #"^--?(.*)" argkey)]
(cond