feat: make missing file notifications optional

This commit is contained in:
Konano 2026-09-30 13:50:29 +08:00
parent ce8905eff5
commit ea1439868a

View File

@ -7,10 +7,13 @@ scriptdir=$(dirname $(realpath $0))
update_file() { update_file() {
local A="$1" local A="$1"
local B="$2" local B="$2"
local notify="${3:-}"
if [ ! -f "$B" ]; then if [ ! -f "$B" ]; then
echo "File $B does not exist, skipping update." if [ "$notify" = "notify" ]; then
printf 'Run: mkdir -p %q && cp %q %q\n' "$(dirname "$B")" "$A" "$B" echo "File $B does not exist, skipping update."
printf 'Run: mkdir -p %q && cp %q %q\n' "$(dirname "$B")" "$A" "$B"
fi
return return
fi fi
@ -49,13 +52,13 @@ update_file $scriptdir/files/.nanorc ~/.nanorc
update_file $scriptdir/files/.vimrc ~/.vimrc update_file $scriptdir/files/.vimrc ~/.vimrc
update_file $scriptdir/files/.tmux.conf ~/.tmux.conf update_file $scriptdir/files/.tmux.conf ~/.tmux.conf
update_file $scriptdir/files/gpg.conf ~/.gnupg/gpg.conf update_file $scriptdir/files/gpg.conf ~/.gnupg/gpg.conf
update_file $scriptdir/files/zsh/00-init.zsh ~/.oh-my-zsh/custom/00-init.zsh update_file $scriptdir/files/zsh/00-init.zsh ~/.oh-my-zsh/custom/00-init.zsh notify
update_file $scriptdir/files/zsh/10-theme.zsh ~/.oh-my-zsh/custom/10-theme.zsh update_file $scriptdir/files/zsh/10-theme.zsh ~/.oh-my-zsh/custom/10-theme.zsh notify
update_file $scriptdir/files/zsh/20-function.zsh ~/.oh-my-zsh/custom/20-function.zsh update_file $scriptdir/files/zsh/20-function.zsh ~/.oh-my-zsh/custom/20-function.zsh notify
update_file $scriptdir/files/zsh/50-env.zsh ~/.oh-my-zsh/custom/50-env.zsh update_file $scriptdir/files/zsh/50-env.zsh ~/.oh-my-zsh/custom/50-env.zsh notify
update_file $scriptdir/files/zsh/51-alias.zsh ~/.oh-my-zsh/custom/51-alias.zsh update_file $scriptdir/files/zsh/51-alias.zsh ~/.oh-my-zsh/custom/51-alias.zsh notify
update_file $scriptdir/files/zsh/80-proxy.zsh ~/.oh-my-zsh/custom/80-proxy.zsh update_file $scriptdir/files/zsh/80-proxy.zsh ~/.oh-my-zsh/custom/80-proxy.zsh notify
update_file $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/90-other.zsh update_file $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/90-other.zsh notify
update_file $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ys-simple.zsh-theme update_file $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ys-simple.zsh-theme
update_file $scriptdir/files/zsh/iterm2_shell_integration.zsh ~/.iterm2_shell_integration.zsh update_file $scriptdir/files/zsh/iterm2_shell_integration.zsh ~/.iterm2_shell_integration.zsh
update_authorized_keys update_authorized_keys