5 exec perldoc -T $0;; |
5 exec perldoc -T $0;; |
6 esac |
6 esac |
7 |
7 |
8 name=${1:-$(basename `pwd`)} |
8 name=${1:-$(basename `pwd`)} |
9 |
9 |
10 if tmux ls -F '#S' | grep -x $name >/dev/null; then |
10 if ! tmux has-session -t "$name" 2>/dev/null; then |
11 if [[ ${TMUX:-} ]]; then |
11 tmux new -d -s "$name" |
12 exec tmux switch-client -t $name |
12 fi |
13 else |
13 |
14 exec tmux attach -t $name |
14 if [ -n "${TMUX:-}" ]; then |
15 fi |
15 exec tmux switch-client -t "$name" |
16 else |
16 else |
17 exec tmux new -s $name |
17 exec tmux attach -t "$name" |
18 fi |
18 fi |
19 |
19 |
20 :<<=cut |
20 :<<=cut |
21 =head1 NAME |
21 =head1 NAME |
22 |
22 |
23 tmuxs - Start or attach session based on cwd or given name |
23 tmuxs - tmux session |
24 |
24 |
25 =head1 SYNOPSIS |
25 =head1 SYNOPSIS |
26 |
26 |
27 tmuxs foobaz |
27 tmuxs foobaz |
28 |
28 |
29 cd ~/proj/quux |
29 cd ~/proj/quux |
30 tmuxs |
30 tmuxs |
|
31 # aka: tmuxs quux |
|
32 |
|
33 =head1 DESCRIPTION |
|
34 |
|
35 tmuxs attaches or switches to a session of the given name, or the cwd's name, |
|
36 creating it if necessary. |
31 |
37 |
32 =cut |
38 =cut |