forked from Shinonome/dots-hyprland
Add subcmds; Not skip backup unless input y/n
This commit is contained in:
@@ -53,15 +53,21 @@ function ask_backup_configs(){
|
||||
showfun backup_clashing_targets
|
||||
printf "${STY_RED}"
|
||||
printf "Would you like to backup clashing dirs/files under \"$XDG_CONFIG_HOME\" and \"$XDG_DATA_HOME\" to \"$BACKUP_DIR\"?"
|
||||
read -p "[y/N] " backup_confirm
|
||||
case $backup_confirm in
|
||||
[yY][eE][sS]|[yY])
|
||||
backup_clashing_targets dots/.config $XDG_CONFIG_HOME "${BACKUP_DIR}/.config"
|
||||
backup_clashing_targets dots/.local/share $XDG_DATA_HOME "${BACKUP_DIR}/.local/share"
|
||||
;;
|
||||
*) echo "Skipping backup..." ;;
|
||||
esac
|
||||
printf "${STY_RST}"
|
||||
while true;do
|
||||
echo " y = Yes, backup"
|
||||
echo " n = No, skip to next"
|
||||
local p; read -p "====> " p
|
||||
case $p in
|
||||
[yY]) echo -e "${STY_BLUE}OK, doing backup...${STY_RST}" ;local backup=true;break ;;
|
||||
[nN]) echo -e "${STY_BLUE}Alright, skipping...${STY_RST}" ;local backup=false;break ;;
|
||||
*) echo -e "${STY_RED}Please enter [y/n].${STY_RST}";;
|
||||
esac
|
||||
done
|
||||
if $backup;then
|
||||
backup_clashing_targets dots/.config $XDG_CONFIG_HOME "${BACKUP_DIR}/.config"
|
||||
backup_clashing_targets dots/.local/share $XDG_DATA_HOME "${BACKUP_DIR}/.local/share"
|
||||
fi
|
||||
}
|
||||
|
||||
#####################################################################################
|
||||
|
||||
Reference in New Issue
Block a user