-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmuxt
executable file
·39 lines (31 loc) · 987 Bytes
/
tmuxt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
## -------------------------------------------------------------------
## Tmux creater/attacher 1.1.0
##
## This is free software: you are free to change and redistribute it.
## There is NO WARRANTY, to the extent permitted by law.
## -------------------------------------------------------------------
### Attaches to the given tmux session, creating it if it doesn't exist.
### Usage:
### tmuxt [options]
### tmuxt <name>
###
### Options
### -h, --help Show help options.
### -v, --version Print program version.
###
### If no name is supplied, "default" is used
help=$(grep "^### " "$0" | cut -c 5-)
version=$(grep "^## " "$0" | cut -c 4-)
eval "$(docopts -A args -h "$help" -V "$version" : "$@")"
if [[ "${args[<name>]}" != "" ]]; then
name="${args[<name>]}"
else
name="default"
fi
echo $name
if [[ -z $(tmux ls | grep "^$name:") ]]; then
TERM=xterm-256color tmux new -s $name
else
TERM=xterm-256color tmux at -t $name
fi