1
0
Files
dotfiles/scripts/utils.sh
Ryan Hamilton 03150e539d feat: implement modular numbered script system
- Add scripts/ directory with numbered execution pattern
- Create 00-check-dependencies.sh for requirement validation
- Create 10-backup-files.sh for conflict handling
- Create 20-setup-stow.sh for symlink creation
- Create 90-post-install.sh for cleanup tasks
- Add scripts/utils.sh with colored logging functions
- Update install.sh to auto-discover and execute numbered scripts
- Remove hardcoded logic in favor of flexible script discovery

Benefits:
- Clean separation of concerns (each script has one job)
- Numbered execution order (SSH/systemd convention)
- Colored output for better UX
- Easy to extend with additional scripts
- Same entry point for all branches
2025-08-04 19:50:21 -05:00

37 lines
580 B
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# scripts/utils.sh - Shared utilities and functions
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Logging functions
log_info() {
echo -e "${BLUE} $1${NC}"
}
log_success() {
echo -e "${GREEN}$1${NC}"
}
log_warning() {
echo -e "${YELLOW}⚠️ $1${NC}"
}
log_error() {
echo -e "${RED}$1${NC}"
}
# Check if command exists
command_exists() {
command -v "$1" &> /dev/null
}
# Check if we're in an interactive shell
is_interactive() {
[[ $- == *i* ]]
}