Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

56 lines (36 sloc) 1.145 kB

shake

A Clojure library shakes your shell.

Usage

Leiningen

[shake "0.2.2"]

Just That Simple

(require '[shake.core :as sh])

;; any shell command ...
(sh/uname -a) ;;returns a #<UNIXProcess java.lang.UNIXProcess@1833160>

;; using clojure variables (vars, local bindings) in shake
(let [home "/home/sunng87"]
  (sh/ls -l $home))

;; using clojure forms in shake
(sh/curl $(format "https://github.com/%s" "sunng87"))

;; if you just want to see the output:
(binding [sh/*print-output* true]
  (sh/uname -a))

I/O

shake extends Process with clojure's IOFactory. So you can (input-stream) or (output-stream) the process to get a streamed I/O.

;; print output of `uname -a`
(print (slurp (input-stream (sh/uname -a))))

Too Slow to Load (Verbose Clojure Warnings) ?

By default, shake indexes all executables under your PATH. To override this behavior, set environment variable SHAKE_PATH before you initialize the namespace shake.core.

License

Copyright © 2012 Sun Ning sunng@about.me

Distributed under the Eclipse Public License, the same as Clojure.

Jump to Line
Something went wrong with that request. Please try again.