Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jlangch committed Sep 1, 2023
1 parent 8107cdd commit c94b108
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/resources/com/github/jlangch/venice/docker.venice
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
(parse-output format (:out (apply docker/cmd cmdargs*))))
(let [out (parse-output :json (:out (docker/cmd "version -f json")))
field (if (== :server type) "Server" "Client")]
(get-in (first out) [field "Version"])))))
(get-in out [field "Version"])))))



Expand Down Expand Up @@ -1001,10 +1001,14 @@

(defn- parse-output [format output]
(if (= format :json)
(-<> (str/split-lines output) ;; docker you're kidding
(str/join "," <>)
(str "[" <> "]")
(json/read-str <>))
;; docker you're kidding
(let [lines (str/split-lines output)]
(if (== 1 (count lines))
(json/read-str output)
(as-> lines $
(str/join "," $)
(str "[" $ "]")
(json/read-str $))))
output))


Expand Down

0 comments on commit c94b108

Please sign in to comment.