Skip to content

Commit

Permalink
Allow vector values in map-to-arg-string
Browse files Browse the repository at this point in the history
In pallet.stevedore/map-to-arg-string, make keys with vector values
result in having the switch repeated for each value in the vector.
  • Loading branch information
hugoduncan committed Sep 19, 2013
1 parent fa83001 commit 01b75bb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/pallet/stevedore.clj
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,17 @@
(let [opt (if do-underscore (underscore (name option)) (name option))]
(if argument
(if (> (.length opt) 1)
(str dash opt (if-not (= argument true)
(str (if do-assign "=" " ") \" argument \")))
(str "-" opt (if-not (= argument true) (str " " \" argument \")))))))
(if (vector? argument)
(string/join
" "
(map #(str dash opt (str (if do-assign "=" " ") \" % \")) argument))
(str dash opt (if-not (= argument true)
(str (if do-assign "=" " ") \" argument \"))))
(if (vector? argument)
(string/join
" "
(map #(str "-" opt (str " " \" % \")) argument))
(str "-" opt (if-not (= argument true) (str " " \" argument \"))))))))

(defn map-to-arg-string
"Output a set of command line switches from a map"
Expand Down

0 comments on commit 01b75bb

Please sign in to comment.