-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay_gui.sh
49 lines (49 loc) · 1.41 KB
/
display_gui.sh
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
#!/bin/bash
# ------------------------------------------------------------------------------
# display_gui.sh box "Message..." --info
# ------------------------------------------------------------------------------
box() {
clear
space=""
declare -A color
color=(
["--danger"]=41
["--success"]=42
["--warning"]=43
["--info"]=44
)
spacing() {
i=0
while [ $i -lt ${#1} ]; do
space+=" "
let i+=1;
done
}
spacing "${1}"
echo -e "\n\033[${color[$2]}m ${space} \033[m\n\033[1;37;${color[$2]}m ${1} \033[m\n\033[${color[$2]}m ${space} \033[m\n"
}
# ------------------------------------------------------------------------------
# display_gui.sh status 8000 --online | --offline
# ------------------------------------------------------------------------------
status() {
clear
space=""
spacing() {
i=0
while [ $i -lt ${#1} ]; do
space+=" "
let i+=1;
done
}
status() {
spacing "---${1}---"
echo -e "\n\033[47m ${space} \033[m\n\033[47m \033[m\033[1;${3};3${4};40m*\033[m\033[0;30;47m ${1} \033[m\033[3${4};40m ${2} \033[m\033[47m \033[m\n\033[47m ${space} \033[m\n"
}
spacing "${1}"
if [ "$2" == "--online" ]; then
status "Listening port:" $1 5 2
elif [ "$2" == "--offline" ]; then
status "Released port:" $1 1 1
fi
}
$@