-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·92 lines (74 loc) · 1.76 KB
/
Copy pathinit.sh
File metadata and controls
executable file
·92 lines (74 loc) · 1.76 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
SCRIPT=$(readlink -f $0)
TOOLINGPATH=$(dirname $SCRIPT)
function toolsUp() {
cat <<EOM
function tools-up() {
(cd $TOOLINGPATH; docker compose up -d \$@)
}
EOM
}
function toolsExec() {
cat <<EOM
function tools-exec() {
(cd $TOOLINGPATH; docker compose exec \$@)
}
EOM
}
function toolsRestart() {
cat <<EOM
function tools-restart() {
(cd $TOOLINGPATH; docker compose restart \$@)
}
EOM
}
function toolsStop() {
cat <<EOM
function tools-stop() {
(cd $TOOLINGPATH; docker compose stop \$@)
}
EOM
}
function toolsDown() {
cat <<EOM
function tools-down() {
(cd $TOOLINGPATH; docker compose down \$@)
}
EOM
}
function addFunctions {
if !(grep -q tools-up ~/.zshrc); then echo "" >>$1 && echo "$(toolsUp)" >/dev/null 2>&1 >>$1; fi
if !(grep -q tools-exec ~/.zshrc); then echo "" >>$1 && echo "$(toolsExec)" >/dev/null 2>&1 >>$1; fi
if !(grep -q tools-restart ~/.zshrc); then echo "" >>$1 && echo "$(toolsRestart)" >/dev/null 2>&1 >>$1; fi
if !(grep -q tools-stop ~/.zshrc); then echo "" >>$1 && echo "$(toolsStop)" >/dev/null 2>&1 >>$1; fi
if !(grep -q tools-down ~/.zshrc); then echo "" >>$1 && echo "$(toolsDown)" >/dev/null 2>&1 >>$1; fi
}
function startup() {
echo "🚀 Launching your tooling"
docker compose up -d
echo "✅ Done"
}
function doneAddingFunctions() {
echo "✅ Done installing functions"
}
function setupBash() {
echo "🤖 Setting up functions in your .bashrc"
addFunctions ~/.bashrc
doneAddingFunctions
}
function setupZsh() {
echo "🤖 Setting up functions in your .zshrc"
addFunctions ~/.zshrc
doneAddingFunctions
}
read -p "Which shell are you using ?
1) Bash
2) Zsh
> " choice
case $choice in
1) setupBash ;;
2) setupZsh ;;
*) echo "Unrecognized selection: $choice" && exit 0 ;;
esac
startup
exec zsh