-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmx
executable file
·43 lines (36 loc) · 1.07 KB
/
tmx
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
39
40
41
42
43
#! /bin/bash
# directory where tmuxsession.sh is executable placed
lib_path=~/.bin
# directory where sessions should been saved
sav_dir=~/.bin/tmuxsessions
function help()
{
cat <<end
tmx [option] [session-name]
-a attachs a session within a new session
-n creates complete new session
-c let you choose a session to attach
-s saves sate of given session in a file requires session name
-r reload state of given session requires session name and save directory
-l list current sessions
in default case a new session is created
end
}
if ! source "$lib_path/tmuxsession.sh"; then
echo "[tmx] tmuxsession.sh cannot found but is necessary"
exit 1
fi
if [[ ! -d $sav_dir ]]; then
echo "[tmx] create session directory"
mkdir -p $sav_dir
fi
case $1 in
-a) shift; attach_session "$@" $sav_dir;;
-n) shift; new_session "$@";;
-s) shift; save_session $1 $sav_dir;;
-r) shift; reload_session $1 $sav_dir;;
-c) shift; choose_session $sav_dir;;
-l) shift; list_sessions $@ ;;
-h) help;;
*) new_session "$@";;
esac