commit 8b1fb75881080789c34d8812df20788cb8b5dec0 (patch)
parent 830eba1738d617f27595e2307709809c8990f683
Author: Alex Karle <alex@alexkarle.com>
Date: Mon, 21 Feb 2022 21:57:34 -0500
bin: Modify plumb(1) to only take first field
All of the types I plumb shouldn't have spaces in them, so this enables
things like plumbing the whole line on git-blame just for the SHA:
c5ba384f (Alex Karle 2022-02-21 20:05:22 -0500 31) [1]: no-color.org
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/bin/plumb b/bin/plumb
@@ -1,16 +1,14 @@
#!/bin/sh
# plumb -- plumber for tmux's copy-pipe
# reads the item to plumb from stdin, optionally takes a working dir
-IFS='
-'
read ITEM
if [ -n "$1" ]; then
cd "$1"
fi
-# trim whitespace off the ITEM
-ITEM=$(echo "$ITEM" | xargs)
+# only accept first argument (by whitespace)
+ITEM=$(echo "$ITEM" | awk '{ print $1 }')
case "$ITEM" in
http*) firefox "$ITEM" ;;