feat: report skipped file updates

This commit is contained in:
Konano 2026-09-30 13:44:34 +08:00
parent 4bd93ee65e
commit ce8905eff5

View File

@ -8,7 +8,13 @@ update_file() {
local A="$1"
local B="$2"
if [ -f "$A" ] && [ -f "$B" ] && [ "$(cat "$A")" != "$(cat "$B")" ]; then
if [ ! -f "$B" ]; then
echo "File $B does not exist, skipping update."
printf 'Run: mkdir -p %q && cp %q %q\n' "$(dirname "$B")" "$A" "$B"
return
fi
if [ -f "$A" ] && [ "$(cat "$A")" != "$(cat "$B")" ]; then
cp "$A" "$B"
echo "File $B has been updated."
fi