Repository navigation
Expand file tree
/
Copy pathdevmenu.sh
More file actions
executable file
·82 lines (69 loc) · 1.88 KB
/
Copy pathdevmenu.sh
File metadata and controls
executable file
·82 lines (69 loc) · 1.88 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
#!/bin/bash
# ============================================
# PROJECT DEV MANAGER PRO - ENTRY POINT
# ============================================
# Non-destructive exit on error, allow script to continue
set -u
set -o pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MODULES_DIR="$SCRIPT_DIR/modules"
# Load Config
if [ -f "$SCRIPT_DIR/config.sh" ]; then
source "$SCRIPT_DIR/config.sh"
else
echo "Error: config.sh not found!"
exit 1
fi
# ============================================
# DIRECTORY-BASED MODULE LOADER
# Urutan load SANGAT PENTING:
# - core : harus paling awal (logging, ui, system)
# - menu : harus paling akhir (butuh semua fungsi siap)
# ============================================
LOAD_ORDER=(
"core"
"i18n"
"service"
"ports"
"database"
"project"
"snapshot"
"devutils"
"git"
"system"
"search"
"monitor"
"menu"
)
for _mod_dir in "${LOAD_ORDER[@]}"; do
_init_file="$MODULES_DIR/$_mod_dir/init.sh"
if [ -f "$_init_file" ]; then
source "$_init_file"
else
echo "Error: init.sh tidak ditemukan untuk modul '$_mod_dir' ($_init_file)"
exit 1
fi
done
unset LOAD_ORDER _mod_dir _init_file
# ============================================
# INITIALIZATION & MAIN LOOP
# ============================================
# Set preview mode to avoid interactive prompts (like sudo) in background
if [ $# -gt 0 ] && [[ "$1" == *"preview"* ]]; then
export DEVMENU_PREVIEW_MODE=true
fi
# Initialize system (handles directories, config, sudo, and plugins)
core_init
# Handle command line arguments to run specific functions (useful for opening in new tabs/previews)
if [ $# -gt 0 ]; then
if declare -f "$1" > /dev/null; then
"$@"
exit 0
else
echo "Error: Command '$1' not found."
exit 1
fi
fi
# Start TUI
log "DevMenu started"
main_loop