dotfiles/commit.sh
Jesper Saastamoinen a580d8b410 Updated dotfiles
2025-07-25 22:53:24 +02:00

28 lines
678 B
Bash
Executable file

#!/bin/bash
ANSI_COLOR_RED="\033[0;31m"
ANSI_COLOR_GREEN="\033[0;32m"
ANSI_COLOR_RESET="\033[0m"
PROJECT_DIR="$HOME/dotfiles"
declare -A files_to_check=(
[".zshrc"]="$HOME/.zshrc"
[".bashrc"]="$HOME/.bashrc"
)
for file_name in "${!files_to_check[@]}"; do
target_path=${files_to_check[$file_name]}
if [ ! -e "$target_path" ]; then
echo -e "\n$ANSI_COLOR_RED Error: $file_name does not exist in $HOME.$ANSI_COLOR_RESET\n”"
exit 1
fi
cp "$target_path" "$PROJECT_DIR/${file_name}"
done
git add .
git commit -m "Updated dotfiles"
echo -e "$ANSI_COLOR_GREEN\n==== Files have been copied and committed to the Git repository.$ANSI_COLOR_RESET\n"
git status