diff options
author | makefu <github@syntax-fehler.de> | 2013-12-30 03:03:22 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2013-12-30 03:03:22 +0100 |
commit | 96151bd07330aee400fb99fd9f8f117bae42c9e5 (patch) | |
tree | 44c3f35a4d89e96ec97812a5879baa30bb4df0b8 /Cancer/bridge/lib | |
parent | 4ae4f5f461a6d5f6290ef7da516ea22db93bfd91 (diff) |
bridge -> Cancer/\1
Diffstat (limited to 'Cancer/bridge/lib')
-rwxr-xr-x | Cancer/bridge/lib/bridge/bin/attach | 10 | ||||
-rwxr-xr-x | Cancer/bridge/lib/bridge/bin/create | 15 | ||||
-rwxr-xr-x | Cancer/bridge/lib/bridge/bin/destroy | 12 | ||||
-rwxr-xr-x | Cancer/bridge/lib/bridge/bin/list | 10 | ||||
-rwxr-xr-x | Cancer/bridge/lib/bridge/bin/paste | 30 |
5 files changed, 77 insertions, 0 deletions
diff --git a/Cancer/bridge/lib/bridge/bin/attach b/Cancer/bridge/lib/bridge/bin/attach new file mode 100755 index 00000000..f456f8a6 --- /dev/null +++ b/Cancer/bridge/lib/bridge/bin/attach @@ -0,0 +1,10 @@ +#! /bin/sh +# +# Attach current tty to a session. +# +## SYNOPSIS +# +# bridge attach SESSION +# +set -euf +exec tmux -L bridge attach-session -t "$1" diff --git a/Cancer/bridge/lib/bridge/bin/create b/Cancer/bridge/lib/bridge/bin/create new file mode 100755 index 00000000..2df8b214 --- /dev/null +++ b/Cancer/bridge/lib/bridge/bin/create @@ -0,0 +1,15 @@ +#! /bin/sh +# +# Create a new session. +# +## SYNOPSIS +# +# bridge create SESSION [COMMAND [ARGS ...]] +# +# COMMAND defaults to $SHELL (by implication / tmux) +# +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/Cancer/bridge/lib/bridge/bin/destroy b/Cancer/bridge/lib/bridge/bin/destroy new file mode 100755 index 00000000..dffdbd8a --- /dev/null +++ b/Cancer/bridge/lib/bridge/bin/destroy @@ -0,0 +1,12 @@ +#! /bin/sh +# +# Destroy a session. +# +## SYNOPSIS +# +# bridge destroy SESSION +# +# Note that this may destroy similar named sessions (by implication / tmux) +# +set -euf +tmux -L bridge kill-session -t "$1" diff --git a/Cancer/bridge/lib/bridge/bin/list b/Cancer/bridge/lib/bridge/bin/list new file mode 100755 index 00000000..0b767a9b --- /dev/null +++ b/Cancer/bridge/lib/bridge/bin/list @@ -0,0 +1,10 @@ +#! /bin/sh +# +# Write a list of all session names to stdout. +# +## SYNOPSIS +# +# bridge list +# +set -euf +exec tmux -L bridge list-sessions | cut -d: -f1 diff --git a/Cancer/bridge/lib/bridge/bin/paste b/Cancer/bridge/lib/bridge/bin/paste new file mode 100755 index 00000000..d3ed1fc5 --- /dev/null +++ b/Cancer/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. |