1aa2e5785e6f

Make pbcopy/pbpaste executables configurable
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 02 Sep 2020 11:45:13 -0400
parents d6cc6af60002
children ea581753e904
branches/tags (none)
files package.lisp src/shell.lisp

Changes

--- a/package.lisp	Mon Aug 31 12:02:39 2020 -0400
+++ b/package.lisp	Wed Sep 02 11:45:13 2020 -0400
@@ -113,7 +113,9 @@
   (:export
     :sh
     :pbcopy
-    :pbpaste))
+    :pbpaste
+    :*pbcopy-command*
+    :*pbpaste-command*))
 
 
 (defpackage :losh.arrays
--- a/src/shell.lisp	Mon Aug 31 12:02:39 2020 -0400
+++ b/src/shell.lisp	Wed Sep 02 11:45:13 2020 -0400
@@ -61,11 +61,17 @@
               result)))))
 
 
+(defparameter *pbcopy-command* "pbcopy"
+  "The shell command to use for `pbcopy`.  When run, this command should set the clipboard contents to its standard input.")
+
+(defparameter *pbpaste-command* "pbpaste"
+  "The shell command to use for `pbpaste`.  When run, this command should print the clipboard contents on standard output.")
+
 (defun pbcopy (object)
   "`pbcopy` the `aesthetic-string` of `object`."
-  (sh "pbcopy" :input (format nil "~A" object) :wait nil)
+  (sh *pbcopy-command* :input (format nil "~A" object) :wait nil)
   (values))
 
 (defun pbpaste ()
   "`pbpaste` the current clipboard as a string."
-  (values (sh "pbpaste" :result-type 'string)))
+  (values (sh *pbpaste-command* :result-type 'string)))