Skip to content

Instantly share code, notes, and snippets.

@uwo
Last active Sep 17, 2018
Embed
What would you like to do?
osxclip
.cpcache
.nrepl-port

deps.edn

{:deps {gist-uwo/osxclip {:git/url "https://gist.github.com/uwo/23b7a81fd97818368400bb7c02086562"
                          :sha "ceee392df6d3f7607bd5e80f0eb80aafcdcda348"}}}
{:paths ["."]
:deps {gist-uwo/pformat {:git/url "https://gist.github.com/uwo/c5ca5aa57e156364dd687cb0538836c6"
:sha "69f2d31ff4a89175e17bab0dcfe5f7db429ffebe"}}}
(ns osxclip
(:require [clojure.java.shell :refer [sh]]
[clojure.edn :as edn]
[pformat :refer [pformat]]))
(defn pbspit*
"Spit to paste buffer"
[in]
(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"
[in]
(pbspit* (pformat in)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment