# Colors RED="\e[31m" GREEN="\e[32m" YELLOW="\e[33m" RESET="\e[0m" # Functions colors echo text echo_error() { echo -e "${RED}$1${RESET}" } echo_warning() { echo -e "${YELLOW}$1${RESET}" } echo_success() { echo -e "${GREEN}$1${RESET}" } # Function to check if a repository exists and perform git pull or git clone update_repository() { local repo_url="$1" local repo_dir="$2" local repo_branch="$3" if [ -d "$repo_dir" ]; then # If the directory exists, then do a git pull echo_warning "Updating $repo_dir..." cd "$repo_dir" || exit git checkout $repo_branch git pull cd - || exit else # If the directory does not exist, then do a git clone echo_warning "Cloning $repo_url into $repo_dir..." git clone -b "$repo_branch" "$repo_url" "$repo_dir" fi }