Dotfiles update 2025-12-24 18:47

This commit is contained in:
Aaron D. Lee
2025-12-24 18:47:10 -05:00
parent 5df638f97e
commit 94b9802bff

View File

@@ -31,6 +31,18 @@ fi
# Colors (fallback when gum not available)
# ============================================================================
# Source shared colors (with fallback)
source "${0:A:h}/../lib/colors.zsh" 2>/dev/null || \
source "$HOME/.dotfiles/zsh/lib/colors.zsh" 2>/dev/null || {
typeset -g DF_NC=$'\033[0m' DF_BOLD=$'\033[1m' DF_DIM=$'\033[2m'
typeset -g DF_BLUE=$'\033[38;5;39m' DF_CYAN=$'\033[38;5;51m'
typeset -g DF_GREEN=$'\033[38;5;82m' DF_YELLOW=$'\033[38;5;220m'
typeset -g DF_RED=$'\033[38;5;196m' DF_GREY=$'\033[38;5;242m' DF_NC=$'\033[0m'
typeset -g DF_LIGHT_BLUE=$'\033[38;5;39m' DF_LIGHT_GREEN=$'\033[38;5;82m'
}
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
@@ -45,7 +57,7 @@ NC='\033[0m'
# MOTD-style header
# ============================================================================
_M_WIDTH=66
DF_WIDTH=66
print_header() {
local user="${USER:-root}"
@@ -53,17 +65,10 @@ print_header() {
local script_name="setup-wizard"
local datetime=$(date '+%a %b %d %H:%M')
# Colors
local _M_RESET=$'\033[0m'
local _M_BOLD=$'\033[1m'
local _M_DIM=$'\033[2m'
local _M_BLUE=$'\033[38;5;39m'
local _M_GREY=$'\033[38;5;242m'
# Build horizontal line
local hline=""
for ((i=0; i<_M_WIDTH; i++)); do hline+="═"; done
local inner=$((_M_WIDTH - 2))
for ((i=0; i<DF_WIDTH; i++)); do hline+="═"; done
local inner=$((DF_WIDTH - 2))
# Header content
local h_left="${user}@${hostname}"
@@ -74,9 +79,9 @@ print_header() {
for ((i=0; i<h_pad; i++)); do h_spaces+=" "; done
echo ""
echo -e "${_M_GREY}${hline}${_M_RESET}"
echo -e "${_M_GREY}${_M_RESET} ${_M_BOLD}${_M_BLUE}${h_left}${_M_RESET}${h_spaces}${_M_DIM}${h_center}${h_spaces}${h_right}${_M_RESET} ${_M_GREY}${_M_RESET}"
echo -e "${_M_GREY}${hline}${_M_RESET}"
echo -e "${DF_GREY}${hline}${DF_RESET}"
echo -e "${DF_GREY}${DF_RESET} ${DF_BOLD}${DF_LIGHT_BLUE}${h_left}${DF_RESET}${h_spaces}${DF_LIGHT_GREEN}${h_center} ${h_spaces}${DF_NC}${DF_BOLD}${h_right}${DF_RESET} ${DF_GREY}${DF_RESET}"
echo -e "${DF_GREY}${hline}${DF_RESET}"
echo ""
}
@@ -95,7 +100,7 @@ check_gum() {
}
install_gum() {
echo -e "${CYAN}Installing gum for beautiful prompts...${NC}"
echo -e "${DF_CYAN}Installing gum for beautiful prompts...${DF_NC}"
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install gum
@@ -115,7 +120,7 @@ gpgcheck=1
gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
sudo dnf install -y gum
else
echo -e "${YELLOW}Could not auto-install gum. Using fallback prompts.${NC}"
echo -e "${DF_YELLOW}Could not auto-install gum. Using fallback prompts.${DF_NC}"
return 1
fi
@@ -139,9 +144,9 @@ wizard_header() {
"$title"
else
echo
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}${NC} ${BOLD}$title${NC}"
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}"
echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${DF_NC}"
echo -e "${BLUE}${DF_NC} ${BOLD}$title${DF_NC}"
echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${DF_NC}"
echo
fi
}
@@ -154,7 +159,7 @@ wizard_spin() {
else
echo -n "$title... "
"$@" &>/dev/null
echo -e "${GREEN}done${NC}"
echo -e "${DF_GREEN}done${DF_NC}"
fi
}
@@ -256,12 +261,12 @@ step_welcome() {
print_header
wizard_header "🚀 Welcome to Dotfiles Setup Wizard"
echo -e "${DIM}This wizard will help you configure your dotfiles installation."
echo -e "You can re-run this wizard anytime with: dotfiles --wizard${NC}"
echo -e "${DF_DIM}This wizard will help you configure your dotfiles installation."
echo -e "You can re-run this wizard anytime with: dotfiles --wizard${DF_NC}"
echo
if ! wizard_confirm "Ready to begin?"; then
echo -e "${YELLOW}Setup cancelled.${NC}"
echo -e "${DF_YELLOW}Setup cancelled.${DF_NC}"
exit 0
fi
}
@@ -269,7 +274,7 @@ step_welcome() {
step_user_info() {
wizard_header "👤 Personal Information"
echo -e "${DIM}This information is used for git config, templates, etc.${NC}"
echo -e "${DF_DIM}This information is used for git config, templates, etc.${DF_NC}"
echo
USER_FULLNAME=$(wizard_input "Full Name" "${USER_FULLNAME:-$(git config --global user.name 2>/dev/null || echo '')}")
@@ -300,7 +305,7 @@ step_shell_choice() {
step_modules() {
wizard_header "📦 Module Selection"
echo -e "${DIM}Select which modules to install:${NC}"
echo -e "${DF_DIM}Select which modules to install:${DF_NC}"
echo
SELECTED_MODULES=$(wizard_multichoose "Choose modules (space to select):" \
@@ -318,7 +323,7 @@ step_modules() {
step_secrets() {
wizard_header "🔐 Secrets Management"
echo -e "${DIM}How would you like to manage secrets (API keys, tokens, etc.)?${NC}"
echo -e "${DF_DIM}How would you like to manage secrets (API keys, tokens, etc.)?${DF_NC}"
echo
SECRETS_METHOD=$(wizard_choose "Secrets management:" \
@@ -340,20 +345,20 @@ step_git_config() {
if wizard_confirm "Configure Git with your information?"; then
git config --global user.name "$USER_FULLNAME"
git config --global user.email "$USER_EMAIL"
echo -e "${GREEN}${NC} Git configured"
echo -e "${DF_GREEN}${DF_NC} Git configured"
fi
if wizard_confirm "Set up SSH key for GitHub?" "no"; then
if [[ ! -f "$HOME/.ssh/id_ed25519" ]]; then
ssh-keygen -t ed25519 -C "$USER_EMAIL" -f "$HOME/.ssh/id_ed25519"
echo -e "${GREEN}${NC} SSH key generated"
echo -e "${DF_GREEN}${DF_NC} SSH key generated"
echo
echo -e "${CYAN}Add this key to GitHub:${NC}"
echo -e "${DF_CYAN}Add this key to GitHub:${DF_NC}"
cat "$HOME/.ssh/id_ed25519.pub"
echo
wizard_confirm "Press Enter when done..."
else
echo -e "${YELLOW}SSH key already exists${NC}"
echo -e "${DF_YELLOW}SSH key already exists${DF_NC}"
fi
fi
}
@@ -377,9 +382,9 @@ step_backup() {
done
if [[ $backed_up -gt 0 ]]; then
echo -e "${GREEN}${NC} Backed up $backed_up files to $backup_dir"
echo -e "${DF_GREEN}${DF_NC} Backed up $backed_up files to $backup_dir"
else
echo -e "${DIM}No existing files to backup${NC}"
echo -e "${DF_DIM}No existing files to backup${DF_NC}"
rmdir "$backup_dir" 2>/dev/null || true
fi
fi
@@ -388,7 +393,7 @@ step_backup() {
step_install() {
wizard_header "⚡ Installation"
echo -e "${DIM}Ready to install with these settings:${NC}"
echo -e "${DF_DIM}Ready to install with these settings:${DF_NC}"
echo
echo " User: $USER_FULLNAME <$USER_EMAIL>"
echo " Shell: $SHELL_CHOICE"
@@ -402,9 +407,9 @@ step_install() {
wizard_spin "Setting up shell" sleep 1
echo
echo -e "${GREEN}${NC} Installation complete!"
echo -e "${DF_GREEN}${DF_NC} Installation complete!"
else
echo -e "${YELLOW}Installation cancelled.${NC}"
echo -e "${DF_YELLOW}Installation cancelled.${DF_NC}"
exit 0
fi
}
@@ -412,15 +417,15 @@ step_install() {
step_summary() {
wizard_header "✨ Setup Complete!"
echo -e "${GREEN}Your dotfiles have been configured successfully!${NC}"
echo -e "${DF_GREEN}Your dotfiles have been configured successfully!${DF_NC}"
echo
echo -e "${BOLD}Quick Commands:${NC}"
echo -e "${BOLD}Quick Commands:${DF_NC}"
echo " dotfiles sync - Sync with remote repository"
echo " dotfiles update - Update dotfiles"
echo " dotfiles doctor - Check installation health"
echo " dotfiles vault - Manage secrets"
echo
echo -e "${DIM}Restart your terminal or run 'source ~/.zshrc' to apply changes.${NC}"
echo -e "${DF_DIM}Restart your terminal or run 'source ~/.zshrc' to apply changes.${DF_NC}"
}
# ============================================================================
@@ -451,7 +456,7 @@ ZSH_FRAMEWORK="${ZSH_FRAMEWORK:-none}"
SECRETS_METHOD="$SECRETS_METHOD"
EOF
echo -e "${GREEN}${NC} Configuration saved to $config_file"
echo -e "${DF_GREEN}${DF_NC} Configuration saved to $config_file"
}
# ============================================================================