#!/usr/bin/env bash ANSI_clear_line="\e[0K" ANSI_color_R="\e[1;31m" ANSI_color_G="\e[1;32m" ANSI_color_Y="\e[1;33m" ANSI_color_B="\e[1;34m" ANSI_color_M="\e[1;35m" ANSI_color_C="\e[1;36m" ANSI_color_W="\e[1;39m" ANSI_reset="\e[0m" function Log() { printf "${ANSI_clear_line}${ANSI_color_W}%s ${ANSI_color_B}%s${ANSI_reset}\n" "$1" "$2" 1>&2 } function ProcessStowOutput() { while IFS= read -r line; do if [[ $line =~ ^LINK:[[:space:]]+ ]]; then # LINK operations in green printf " - ${ANSI_clear_line}${ANSI_color_G}${line}${ANSI_reset}\n" 1>&2 elif [[ $line =~ ^UNLINK:[[:space:]]+ ]]; then # UNLINK operations in red printf " - ${ANSI_clear_line}${ANSI_color_R}${line}${ANSI_reset}\n" 1>&2 elif [[ $line =~ ^SKIP:[[:space:]]+ ]]; then # SKIP operations in yellow printf " - ${ANSI_clear_line}${ANSI_color_Y}${line}${ANSI_reset}\n" 1>&2 else # Other lines in cyan printf " - ${ANSI_clear_line}${ANSI_color_C}${line}${ANSI_reset}\n" 1>&2 fi done } function Stow() { Log "Stowing" "$1" stow --dotfiles -v "$1" 2>&1 | ProcessStowOutput Log "Done with" "$1" } Stow alacritty Stow bash Stow fonts Stow git Stow gpg Stow hyprland Stow kvantum Stow lf Stow qute Stow wayland-basics