commit cd1cde4a7a84d4fb80eec6057d8adc97fc9cdc13 (patch)
parent cf792a9f45d40313a4a61a2762a8df5aadfba61e
Author: Alex Karle <alex@alexkarle.com>
Date: Wed, 16 Feb 2022 00:26:51 -0500
bin: Add xclip support to demo(1)
This gets a bit hairy--I probably don't want the 'Script start..'
lines or the carriage returns, so I hacked together some tr(1) &
sed(1) pipeline to remove hopefully most of the garbage?
Still have yet to see a real test.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/bin/demo b/bin/demo
@@ -9,3 +9,8 @@ EOM
export ENV=/tmp/demo.env
script /tmp/demo.out
+
+if command -v xclip >/dev/null; then
+ sed -e '1d' -e '/^\$ ^D/d' -e '$d' /tmp/demo.out | tr -d '\r' | xclip
+ echo "Demo output copied to middle-mouse clipboard!"
+fi