diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-16 18:55:44 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-16 18:55:44 +0200 |
| commit | cc576c42c2d81d6201658271541bc13fb4229615 (patch) | |
| tree | b0244bc3bc92ca36aad16a07e2dd488e58311896 /dot-backup.sh | |
| parent | db404714f29ca0230e1a2ba48f7fdc23ff511dbb (diff) | |
| download | dots-backup-cc576c42c2d81d6201658271541bc13fb4229615.tar.gz dots-backup-cc576c42c2d81d6201658271541bc13fb4229615.zip | |
feat: skip editor/temp junk in --suggest output
Vim undo/swap files, backups, *.tmp and .DS_Store matched the home-dir
scan and cluttered suggestions. Filter them by suffix in both scan loops.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'dot-backup.sh')
| -rwxr-xr-x | dot-backup.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/dot-backup.sh b/dot-backup.sh index e95c67f..892529c 100755 --- a/dot-backup.sh +++ b/dot-backup.sh @@ -251,6 +251,15 @@ _suggest_ignored() { return 1 } +# True if basename $1 looks like editor/temp junk (vim undo/swap, backups, etc.) +_suggest_junk() { + local b="$1" + case "$b" in + *.un~|*~|*.swp|*.swo|*.tmp|.DS_Store) return 0 ;; + *) return 1 ;; + esac +} + do_suggest() { local epoch_file="${DEFAULT_OUTPUT_DIR}/lastupdate.epoch" local last_epoch=0 @@ -272,6 +281,7 @@ do_suggest() { [[ -e "$path" ]] || continue base="$(basename "$path")" emit=".config/${base}" + _suggest_junk "$base" && continue _suggest_ignored "$base" && continue _suggest_covered "$emit" && continue mtime="$(stat -c %Y "$path" 2>/dev/null || echo 0)" @@ -284,6 +294,7 @@ do_suggest() { [[ "$base" == "." || "$base" == ".." ]] && continue [[ -d "$path" || -f "$path" ]] || continue emit="${base}" + _suggest_junk "$base" && continue _suggest_ignored "$base" && continue _suggest_covered "$emit" && continue mtime="$(stat -c %Y "$path" 2>/dev/null || echo 0)" |
