summaryrefslogtreecommitdiffstats
path: root/bridge/lib
diff options
context:
space:
mode:
authortv <tv@iiso>2011-09-27 00:12:32 +0200
committertv <tv@iiso>2011-09-27 00:12:32 +0200
commitf541b6139ca8ecbc64c736179604280e3006bede (patch)
tree58ac7c926a00b0573a0173dd1de91506bcab098a /bridge/lib
parentf56a4735ade90afcc719d9b87e941a665768db70 (diff)
//bridge: initial commit
Diffstat (limited to 'bridge/lib')
-rwxr-xr-xbridge/lib/bridge/bin/attach3
-rwxr-xr-xbridge/lib/bridge/bin/create6
-rwxr-xr-xbridge/lib/bridge/bin/destroy3
-rwxr-xr-xbridge/lib/bridge/bin/list3
-rwxr-xr-xbridge/lib/bridge/bin/paste17
5 files changed, 32 insertions, 0 deletions
diff --git a/bridge/lib/bridge/bin/attach b/bridge/lib/bridge/bin/attach
new file mode 100755
index 00000000..2edefbe3
--- /dev/null
+++ b/bridge/lib/bridge/bin/attach
@@ -0,0 +1,3 @@
+#! /bin/sh
+set -euf
+exec tmux -L bridge attach-session -t "$1"
diff --git a/bridge/lib/bridge/bin/create b/bridge/lib/bridge/bin/create
new file mode 100755
index 00000000..31b2f3d8
--- /dev/null
+++ b/bridge/lib/bridge/bin/create
@@ -0,0 +1,6 @@
+#! /bin/sh
+set -euf
+target="$1"; shift
+tmux -L bridge new-session -d -s "$target" "$@"
+tmux -L bridge set-buffer READY.
+exec "$(dirname $0)/attach" "$target"
diff --git a/bridge/lib/bridge/bin/destroy b/bridge/lib/bridge/bin/destroy
new file mode 100755
index 00000000..f625d138
--- /dev/null
+++ b/bridge/lib/bridge/bin/destroy
@@ -0,0 +1,3 @@
+#! /bin/sh
+set -euf
+tmux -L bridge kill-session -t "$1"
diff --git a/bridge/lib/bridge/bin/list b/bridge/lib/bridge/bin/list
new file mode 100755
index 00000000..8b164516
--- /dev/null
+++ b/bridge/lib/bridge/bin/list
@@ -0,0 +1,3 @@
+#! /bin/sh
+set -euf
+exec tmux -L bridge list-sessions | cut -d: -f1
diff --git a/bridge/lib/bridge/bin/paste b/bridge/lib/bridge/bin/paste
new file mode 100755
index 00000000..d5a768ad
--- /dev/null
+++ b/bridge/lib/bridge/bin/paste
@@ -0,0 +1,17 @@
+#! /bin/sh
+set -euf
+target="$1"; shift
+if test $# -gt 0; then
+ tmux -L bridge set-buffer -b 0 "$*"
+else
+ if test -n "${VIMRUNTIME-}" || tty >/dev/null; then
+ temp=`mktemp`
+ trap "rm -f $temp" EXIT INT TERM
+ cat>$temp
+ else
+ temp=-
+ fi
+ tmux -L bridge load-buffer -b 0 $temp
+fi
+tmux -L bridge paste-buffer -b 0 -t "$target"
+tmux -L bridge set-buffer -b 0 READY.