-
Notifications
You must be signed in to change notification settings - Fork 0
/
devner.sh
executable file
·90 lines (82 loc) · 2.32 KB
/
devner.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
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
#!/bin/bash
# FOLDER
SRCS_DIR=$(cd $(dirname $0); pwd)
PROJECTS_DIR="${SRCS_DIR}/projects"
STATUS=0
# Source style scripts
source "${SRCS_DIR}/cli/utils/style.sh"
source "${SRCS_DIR}/cli/utils/helpers.sh"
source "${SRCS_DIR}/cli/utils/help.sh"
source "${SRCS_DIR}/cli/utils/credit.sh"
source "${SRCS_DIR}/cli/utils/menu.sh"
# Source command scripts
source "${SRCS_DIR}/cli/cmd/general_commands.sh"
source "${SRCS_DIR}/cli/cmd/db_commands.sh"
source "${SRCS_DIR}/cli/cmd/quick_access_commands.sh"
source "${SRCS_DIR}/cli/cmd/other_commands.sh"
source "${SRCS_DIR}/cli/cmd/caddyfile_commands.sh"
source "${SRCS_DIR}/cli/cmd/project_commands.sh"
source "${SRCS_DIR}/cli/cmd/wp_cli_commands.sh"
# Style
THEME=${NC}
# Check if the projects directory exists
if [ ! -d "${PROJECTS_DIR}" ]; then
mkdir -p "${PROJECTS_DIR}"
fi
# Check if Cadddyfile exists
if [ ! -f "${SRCS_DIR}/services/frankenphp/Caddyfile" ]; then
cp "${SRCS_DIR}/services/frankenphp/default/Caddyfile.example" "${SRCS_DIR}/services/frankenphp/Caddyfile"
fi
if [ -z "$1" ]; then
while true; do
show_menu
handle_menu_selection
done
else
case $1 in
up|down|stop|rebuild|delete|nocache|reload)
execute_general_command $1
;;
wp)
execute_wp_cli $@
;;
node|frankenphp)
execute_quick_access_command $1
;;
ps|alias|code)
execute_other_command $1
;;
postgres|mysql)
execute_db_command $1
;;
help|--h)
show_help
;;
credit|--c)
handle_credit
;;
new-mysql|new-postgres)
execute_new_db_command $@
;;
remove-mysql|remove-postgres)
execute_remove_db_command $@
;;
check-mysql|check-postgres)
execute_db_user_check $@
;;
new|--n|delete|--d)
execute_project_command $@
;;
add-host|remove-host|list-hosts)
execute_caddyfile $@
;;
open)
make dev -C ${SRCS_DIR}
;;
*)
echo -e "\n${RED}Invalid command${NC}: $1\n"
echo -e "Run ${YELLOW}$0 help${NC} to see the list of available commands."
exit 1
;;
esac
fi