Krolyxon
Commit 24ee83b

Branches

Refs →

aurora24ee83b

install.sh: add SUCCESS log as well

Author
krolxon
Date
2026-01-01 22:13 +0530
Parent
884fda0
Commit
24ee83b90fd783eba97fc4c602977750040e124b

+11 −9

1 file changed

  1. M install.sh +11 −9
M install.sh View
@@ -4,15 +4,17 @@ log() {
44 local level="$1"
55 shift
66
7+ local color reset='\033[0m'
78 case "$level" in
8− INFO) color='\033[0;32m' ;;
9− WARN) color='\033[0;33m' ;;
10− ERROR) color='\033[0;31m' ;;
11− *) color='\033[0m' ;;
9+ INFO) color='\033[0;34m' ;; # Blue
10+ WARN) color='\033[0;33m' ;; # Yellow
11+ ERROR) color='\033[0;31m' ;; # Red
12+ SUCCESS) color='\033[0;32m' ;; # Green
13+ *) color='\033[0m' ;;
1214 esac
1315
1416 printf '%b[%s] [%s]%b %s\n' \
15− "$color" "$(date '+%H:%M:%S')" "$level" '\033[0m' "$*"
17+ "$color" "$(date '+%H:%M:%S')" "$level" "$reset" "$*" >&2
1618 }
1719
1820 # Prevent user from running this script as root
@@ -89,7 +91,7 @@ if [[ "$confirm" =~ ^[Yy]$ ]]; then
8991 if [[ -z "$conflicts" ]]; then
9092 log INFO "No conflicts. Running stow normally..."
9193 stow . --no-folding \
92− && log INFO "Dotfiles stowed successfully" \
94+ && log SUCCESS "Dotfiles stowed successfully" \
9395 || log ERROR "Stow failed"
9496 else
9597 log WARN "These paths conflict and will be removed:"
@@ -131,7 +133,7 @@ if [[ "$SHELL" != "$(which zsh)" ]]; then
131133 read -rp "Change default shell to ZSH? (y/N): " confirm
132134 if [[ "$confirm" =~ ^[Yy]$ ]]; then
133135 chsh -s $(which zsh) \
134− && log INFO "Default shell successfully set to zsh" \
136+ && log SUCCESS "Default shell successfully set to zsh" \
135137 || log ERROR "Default shell could not be set to zsh"
136138 fi
137139 else
@@ -145,7 +147,7 @@ if [[ "$confirm" =~ ^[Yy]$ ]]; then
145147 log INFO "Copying keyd configuration to /etc/keyd/default.conf"
146148 sudo cp "$currentDir/system/etc/keyd/default.conf" /etc/keyd/
147149 sudo systemctl enable --now keyd.service \
148− && log INFO "Successfully enabled keyd.service" \
150+ && log SUCCESS "Successfully enabled keyd.service" \
149151 || log ERROR "Couldn't enable keyd.service"
150152 fi
151153
@@ -153,4 +155,4 @@ fi
153155
154156 printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
155157 echo ""
156−log INFO "Done!"
158+log SUCCESS "Done!"