1
0
Fork 0
mirror of https://github.com/SeriousBug/dotfiles synced 2025-12-07 05:22:34 -06:00

Add --force-deploy and --skip-brew flags to setup script

Adds two new command-line flags to enhance setup script flexibility:
- --force-deploy: Passes -f flag to dotter deploy for forced deployment
- --skip-brew: Skips all Homebrew package installation steps

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Kaan Barmore-Genc 2025-11-15 23:00:27 -06:00
parent 989fab7a18
commit a40f25b734

View file

@ -1,31 +1,52 @@
#!/usr/bin/env bash
set -e
set -eo pipefail
# Parse command line arguments
RESET_CONFIG=false
if [[ "$1" == "--reset" ]]; then
FORCE_DEPLOY=false
SKIP_BREW=false
for arg in "$@"; do
case $arg in
--reset)
RESET_CONFIG=true
echo "Resetting configuration (will re-prompt for all variables)..."
fi
;;
--force-deploy)
FORCE_DEPLOY=true
echo "Force deployment mode enabled..."
;;
--skip-brew)
SKIP_BREW=true
echo "Skipping Homebrew package installation..."
;;
*)
echo "Unknown option: $arg"
echo "Usage: $0 [--reset] [--force-deploy] [--skip-brew]"
exit 1
;;
esac
done
echo "Setting up dotfiles environment..."
# Detect OS
OS="$(uname -s)"
# Check if Homebrew is installed
if ! command -v brew &> /dev/null; then
if [[ "$SKIP_BREW" == false ]]; then
# Check if Homebrew is installed
if ! command -v brew &> /dev/null; then
echo "Homebrew is not installed. Please install it first:"
echo "https://brew.sh"
exit 1
fi
fi
echo "Updating Homebrew..."
brew update
echo "Updating Homebrew..."
brew update
# Install packages (available on both macOS and Linux)
PACKAGES=(
# Install packages (available on both macOS and Linux)
PACKAGES=(
dotter
fish
dust
@ -43,20 +64,20 @@ PACKAGES=(
zoxide
zellij
p7zip
)
)
echo "Installing packages..."
for package in "${PACKAGES[@]}"; do
echo "Installing packages..."
for package in "${PACKAGES[@]}"; do
if brew list "$package" &>/dev/null; then
echo "$package already installed"
else
echo "Installing $package..."
brew install "$package"
fi
done
done
# Install casks on macOS only
if [[ "$OS" == "Darwin" ]]; then
# Install casks on macOS only
if [[ "$OS" == "Darwin" ]]; then
echo "Installing macOS-specific casks..."
CASKS=(
@ -72,8 +93,9 @@ if [[ "$OS" == "Darwin" ]]; then
brew install --cask "$cask"
fi
done
else
else
echo "Skipping macOS-specific casks (not on macOS)"
fi
fi
# Set up GitHub CLI authentication
@ -153,10 +175,18 @@ EOF
# Deploy dotfiles
echo ""
echo "Deploying dotfiles..."
if dotter deploy -v; then
echo "✓ Dotfiles deployed successfully!"
if [[ "$FORCE_DEPLOY" == true ]]; then
if dotter deploy -f -v; then
echo "✓ Dotfiles deployed successfully (forced)!"
else
echo "⚠ Dotter deployment failed."
fi
else
if dotter deploy -v; then
echo "✓ Dotfiles deployed successfully!"
else
echo "⚠ Dotter deployment failed. You may need to run 'dotter deploy -f' to force deployment."
fi
fi
echo ""
@ -164,6 +194,8 @@ echo "✓ Setup complete!"
echo ""
echo "Configuration saved to: $USER_VARS_FILE"
echo "To reconfigure, run: ./setup.sh --reset"
echo "To force deployment, run: ./setup.sh --force-deploy"
echo "To skip Homebrew packages, run: ./setup.sh --skip-brew"
echo ""
echo "Next steps:"
echo " 1. Consider setting fish as your default shell: chsh -s \$(which fish)"