Skip to content

Instantly share code, notes, and snippets.

Last active Sep 17, 2018
What would you like to do?


{:deps {gist-uwo/osxclip {:git/url ""
                          :sha "ceee392df6d3f7607bd5e80f0eb80aafcdcda348"}}}
{:paths ["."]
:deps {gist-uwo/pformat {:git/url ""
:sha "69f2d31ff4a89175e17bab0dcfe5f7db429ffebe"}}}
(ns osxclip
(:require [ :refer [sh]]
[clojure.edn :as edn]
[pformat :refer [pformat]]))
(defn pbspit*
"Spit to paste buffer"
(sh "pbcopy" :in in))
(defn pbslurp
"Slurp from paste buffer"
(:out (sh "pbpaste")))
(defn pbslurpe
"Slurp from paste buffer and read as edn"
(pbslurpe {:readers *data-readers*}))
([{:keys [readers]}]
(edn/read-string {:readers readers} (pbslurp))))
(defn pbspit
"Spit to paste buffer in pretty format"
(pbspit* (pformat in)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment