docs: add UI screenshots and logging section
This commit is contained in:
parent
2a0053dee5
commit
bd9f96f3a9
4 changed files with 111 additions and 66 deletions
|
|
@ -11,24 +11,85 @@ get_log_file() {
|
|||
|
||||
if [[ -f "$primary" ]]; then
|
||||
echo "$primary"
|
||||
else
|
||||
elif [[ -f "$fallback" ]]; then
|
||||
echo "$fallback"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
show_log_menu() {
|
||||
while true; do
|
||||
log_choice=$(dialog --clear \
|
||||
--backtitle "Update Manager" \
|
||||
--title "Log menu" \
|
||||
--menu "Select log action:" 18 60 10 \
|
||||
1 "View full log" \
|
||||
2 "Follow log live" \
|
||||
3 "Show log location" \
|
||||
4 "Show last 20 log lines" \
|
||||
0 "Back" \
|
||||
3>&1 1>&2 2>&3)
|
||||
|
||||
clear
|
||||
|
||||
case "$log_choice" in
|
||||
1)
|
||||
log_file="$(get_log_file)"
|
||||
if [[ -n "$log_file" ]]; then
|
||||
less "$log_file"
|
||||
else
|
||||
echo "No log file found yet."
|
||||
read -rp "Press Enter to continue..."
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
log_file="$(get_log_file)"
|
||||
if [[ -n "$log_file" ]]; then
|
||||
echo "Press Ctrl+C to stop"
|
||||
tail -n 20 -f "$log_file"
|
||||
else
|
||||
echo "No log file found yet."
|
||||
fi
|
||||
read -rp "Press Enter to continue..."
|
||||
;;
|
||||
3)
|
||||
log_file="$(get_log_file)"
|
||||
if [[ -n "$log_file" ]]; then
|
||||
echo "Log file:"
|
||||
echo "$log_file"
|
||||
else
|
||||
echo "No log file found yet."
|
||||
fi
|
||||
read -rp "Press Enter to continue..."
|
||||
;;
|
||||
4)
|
||||
log_file="$(get_log_file)"
|
||||
if [[ -n "$log_file" ]]; then
|
||||
tail -n 20 "$log_file"
|
||||
else
|
||||
echo "No log file found yet."
|
||||
fi
|
||||
read -rp "Press Enter to continue..."
|
||||
;;
|
||||
0|"")
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
while true; do
|
||||
choice=$(dialog --clear \
|
||||
--backtitle "Update Manager" \
|
||||
--title "Choose an action" \
|
||||
--menu "Select option:" 16 60 9 \
|
||||
--menu "Select option:" 20 60 10 \
|
||||
1 "Check all hosts" \
|
||||
2 "View hosts file" \
|
||||
3 "Edit hosts file" \
|
||||
4 "Add host" \
|
||||
5 "Remove host" \
|
||||
6 "View full log" \
|
||||
7 "Follow log live" \
|
||||
8 "Show log location" \
|
||||
6 "Log menu" \
|
||||
0 "Exit" \
|
||||
3>&1 1>&2 2>&3)
|
||||
|
||||
|
|
@ -40,12 +101,7 @@ while true; do
|
|||
read -rp "Press Enter to continue..."
|
||||
;;
|
||||
2)
|
||||
if [[ -f "$HOSTS_FILE" ]]; then
|
||||
less "$HOSTS_FILE"
|
||||
else
|
||||
echo "Hosts file not found: $HOSTS_FILE"
|
||||
read -rp "Press Enter to continue..."
|
||||
fi
|
||||
less "$HOSTS_FILE"
|
||||
;;
|
||||
3)
|
||||
nano "$HOSTS_FILE"
|
||||
|
|
@ -54,34 +110,27 @@ while true; do
|
|||
read -rp "Name: " name
|
||||
read -rp "IP: " ip
|
||||
read -rp "User: " user
|
||||
echo "$name $ip $user" >> "$HOSTS_FILE"
|
||||
echo "Host added."
|
||||
if [[ -z "$name" || -z "$ip" || -z "$user" ]]; then
|
||||
echo "All fields are required."
|
||||
else
|
||||
echo "$name $ip $user" >> "$HOSTS_FILE"
|
||||
echo "Host added."
|
||||
fi
|
||||
read -rp "Press Enter to continue..."
|
||||
;;
|
||||
5)
|
||||
if [[ -f "$HOSTS_FILE" ]]; then
|
||||
nl -w2 -s'. ' "$HOSTS_FILE"
|
||||
read -rp "Line to remove: " line
|
||||
nl -w2 -s'. ' "$HOSTS_FILE"
|
||||
read -rp "Line to remove: " line
|
||||
if [[ "$line" =~ ^[0-9]+$ ]]; then
|
||||
sed -i "${line}d" "$HOSTS_FILE"
|
||||
echo "Host removed."
|
||||
else
|
||||
echo "Hosts file not found: $HOSTS_FILE"
|
||||
echo "Invalid line number."
|
||||
fi
|
||||
read -rp "Press Enter to continue..."
|
||||
;;
|
||||
6)
|
||||
less "$(get_log_file)"
|
||||
;;
|
||||
7)
|
||||
echo "Following log: $(get_log_file)"
|
||||
echo "Press Ctrl+C to stop."
|
||||
tail -f "$(get_log_file)"
|
||||
read -rp "Press Enter to continue..."
|
||||
;;
|
||||
8)
|
||||
echo "Log file:"
|
||||
echo "$(get_log_file)"
|
||||
read -rp "Press Enter to continue..."
|
||||
show_log_menu
|
||||
;;
|
||||
0|"")
|
||||
clear
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue