aurora24ee83b
install.sh: add SUCCESS log as well
+11 −9
1 file changed
- M install.sh +11 −9
| @@ -4,15 +4,17 @@ log() { | |||
| 4 | 4 | local level="$1" | |
| 5 | 5 | shift | |
| 6 | 6 | ||
| 7 | + | local color reset='\033[0m' | |
| 7 | 8 | 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' ;; | |
| 12 | 14 | esac | |
| 13 | 15 | ||
| 14 | 16 | 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 | |
| 16 | 18 | } | |
| 17 | 19 | ||
| 18 | 20 | # Prevent user from running this script as root | |
| @@ -89,7 +91,7 @@ if [[ "$confirm" =~ ^[Yy]$ ]]; then | |||
| 89 | 91 | if [[ -z "$conflicts" ]]; then | |
| 90 | 92 | log INFO "No conflicts. Running stow normally..." | |
| 91 | 93 | stow . --no-folding \ | |
| 92 | − | && log INFO "Dotfiles stowed successfully" \ | |
| 94 | + | && log SUCCESS "Dotfiles stowed successfully" \ | |
| 93 | 95 | || log ERROR "Stow failed" | |
| 94 | 96 | else | |
| 95 | 97 | log WARN "These paths conflict and will be removed:" | |
| @@ -131,7 +133,7 @@ if [[ "$SHELL" != "$(which zsh)" ]]; then | |||
| 131 | 133 | read -rp "Change default shell to ZSH? (y/N): " confirm | |
| 132 | 134 | if [[ "$confirm" =~ ^[Yy]$ ]]; then | |
| 133 | 135 | chsh -s $(which zsh) \ | |
| 134 | − | && log INFO "Default shell successfully set to zsh" \ | |
| 136 | + | && log SUCCESS "Default shell successfully set to zsh" \ | |
| 135 | 137 | || log ERROR "Default shell could not be set to zsh" | |
| 136 | 138 | fi | |
| 137 | 139 | else | |
| @@ -145,7 +147,7 @@ if [[ "$confirm" =~ ^[Yy]$ ]]; then | |||
| 145 | 147 | log INFO "Copying keyd configuration to /etc/keyd/default.conf" | |
| 146 | 148 | sudo cp "$currentDir/system/etc/keyd/default.conf" /etc/keyd/ | |
| 147 | 149 | sudo systemctl enable --now keyd.service \ | |
| 148 | − | && log INFO "Successfully enabled keyd.service" \ | |
| 150 | + | && log SUCCESS "Successfully enabled keyd.service" \ | |
| 149 | 151 | || log ERROR "Couldn't enable keyd.service" | |
| 150 | 152 | fi | |
| 151 | 153 | ||
| @@ -153,4 +155,4 @@ fi | |||
| 153 | 155 | ||
| 154 | 156 | printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = | |
| 155 | 157 | echo "" | |
| 156 | − | log INFO "Done!" | |
| 158 | + | log SUCCESS "Done!" | |