(sh-cmd & [{:keys [cmd opts]}])
Execute a single shell command.
(sh-cmd {:cmd ["ls"]})) (sh-cmd {:cmd ["ls"] :opts {:dir (expand-path "~/projects")}}))
Execute a single shell command. (sh-cmd {:cmd ["ls"]})) (sh-cmd {:cmd ["ls"] :opts {:dir (expand-path "~/projects")}}))
(sh-cmds commands)
Execute multiple shell command stop on the first error.
Example: ;; Building multiple Clojure projects with Leiningen (sh-cmds [{:cmd ["lein" "deps" ":tree"] :opts {:dir (expand-path "~/apps/swiza/swiza-vault")}} {:cmd ["lein" "deps" ":tree"] :opts {:dir (expand-path "~/apps/swiza/swiza-jenkins")}}])
Execute multiple shell command stop on the first error. Example: ;; Building multiple Clojure projects with Leiningen (sh-cmds [{:cmd ["lein" "deps" ":tree"] :opts {:dir (expand-path "~/apps/swiza/swiza-vault")}} {:cmd ["lein" "deps" ":tree"] :opts {:dir (expand-path "~/apps/swiza/swiza-jenkins")}}])
(sh-exec cmd
&
[{:keys [opts success-fn error-fn]
:or {success-fn identity error-fn identity}}])
Execute a shell command and process the result using the callback style function.
Example:
;; Run the command ls
and parse the result on success.
(sh-exec ["ls" "-alt"]
{:opts {:dir (expand-path ".")}
:success-fn (fn [x]
(if-let [lines (clojure.string/split x #"
")]
(map #(clojure.string/split % #"\s+") (rest lines))))})
Execute a shell command and process the result using the callback style function. Example: ;; Run the command `ls` and parse the result on success. (sh-exec ["ls" "-alt"] {:opts {:dir (expand-path ".")} :success-fn (fn [x] (if-let [lines (clojure.string/split x #" ")] (map #(clojure.string/split % #"\s+") (rest lines))))})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close