Merge pull request #1 from olwooz/fix

Fix based on PR comment
This commit is contained in:
Dongun Yi 2025-05-24 14:38:20 +09:00 committed by GitHub
commit 05637d1c91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -341,15 +341,23 @@ setup_zshrc() {
echo "${FMT_YELLOW}Found ${zdot}/.zshrc.${FMT_RESET} ${FMT_GREEN}Keeping...${FMT_RESET}" echo "${FMT_YELLOW}Found ${zdot}/.zshrc.${FMT_RESET} ${FMT_GREEN}Keeping...${FMT_RESET}"
return return
fi fi
# Ask user for confirmation before backing up and overwriting # Ask user for confirmation before backing up and overwriting
echo "${FMT_YELLOW}Found ${zdot}/.zshrc." echo "${FMT_YELLOW}Found ${zdot}/.zshrc."
echo "The existing .zshrc will be backed up to .zshrc.pre-oh-my-zsh if overwritten." echo "The existing .zshrc will be backed up to .zshrc.pre-oh-my-zsh if overwritten."
read -p "Do you want to overwrite it with the Oh My Zsh template? [Y/n]${FMT_RESET} " response echo "Make sure your .zshrc contains the following minimal configuration if you choose not to overwrite it:${FMT_RESET}"
response="$(printf '%s' "$response" | tr '[:upper:]' '[:lower:]')" # Convert to lowercase echo "----------------------------------------"
if [ "$response" = "n" ]; then cat "$ZSH/templates/minimal.zshrc"
echo "${FMT_GREEN}Skipping overwrite. Existing .zshrc will be kept.${FMT_RESET}" echo "----------------------------------------"
return printf '%sDo you want to overwrite it with the Oh My Zsh template? [Y/n]%s ' \
fi "$FMT_YELLOW" "$FMT_RESET"
read -r opt
case $opt in
[Yy]*|"") ;;
[Nn]*) echo "Overwrite skipped. Existing .zshrc will be kept."; return ;;
*) echo "Invalid choice. Overwrite skipped. Existing .zshrc will be kept."; return ;;
esac
if [ -e "$OLD_ZSHRC" ]; then if [ -e "$OLD_ZSHRC" ]; then
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)" OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
if [ -e "$OLD_OLD_ZSHRC" ]; then if [ -e "$OLD_OLD_ZSHRC" ]; then