diff options
author | makefu <root@pigstarter.de> | 2013-12-30 14:34:38 +0100 |
---|---|---|
committer | makefu <root@pigstarter.de> | 2013-12-30 14:34:38 +0100 |
commit | 08aa5e406a1f7b39182e79ea4eb7fabf7d61eaa3 (patch) | |
tree | 2db1a54f336167cc3cc3d5f74c77d029fe7e7470 /bridge/lib/bridge/bin/paste | |
parent | 133e49566c74f1d21c28536ed31d1514725ed49b (diff) |
//Cancer -> //
because that is what painload is all about
Diffstat (limited to 'bridge/lib/bridge/bin/paste')
-rwxr-xr-x | bridge/lib/bridge/bin/paste | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bridge/lib/bridge/bin/paste b/bridge/lib/bridge/bin/paste new file mode 100755 index 00000000..d3ed1fc5 --- /dev/null +++ b/bridge/lib/bridge/bin/paste @@ -0,0 +1,30 @@ +#! /bin/sh +# +# Paste some data to a session. +# +## SYNOPSIS +# +# bridge paste SESSION DATA... +# bridge paste SESSION < DATA +# +set -euf + +target="$1"; shift + +# paste args or stdin +if test $# -gt 0; then + tmux -L bridge set-buffer -b 0 "$*" +else + # use aux file instead of direct stdin for Vim and when used from $SHELL + if test -n "${VIMRUNTIME-}" || tty >/dev/null; then + path=`mktemp` + trap "rm -f $path" EXIT INT TERM + cat>$path + else + path=- + fi + tmux -L bridge load-buffer -b 0 $path +fi + +tmux -L bridge paste-buffer -b 0 -t "$target" +tmux -L bridge set-buffer -b 0 READY. |