From 9ee7d5231513ef7bd51d51dac73693922814cde2 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 6 May 2026 12:25:09 +0200 Subject: feat: files.list replaces hardcoded array when non-empty Previously files.list appended to the built-in DOTFILES array, causing duplicate processing. Now a non-empty files.list replaces the array entirely; missing or empty file falls back to the hardcoded defaults. Co-Authored-By: Claude Sonnet 4.6 --- dot-backup.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'dot-backup.sh') diff --git a/dot-backup.sh b/dot-backup.sh index 0e22d70..f58c873 100755 --- a/dot-backup.sh +++ b/dot-backup.sh @@ -160,8 +160,18 @@ DOTFILES=( "/etc/bash_completion.d" ) -# Load external list if it exists, appending to built-in list +# Use external list exclusively if it exists and is non-empty +_has_external_list=false if [[ -f "$DOTFILES_LIST" ]]; then + while IFS= read -r line || [[ -n "$line" ]]; do + [[ "$line" =~ ^#.*$ || -z "$line" ]] && continue + _has_external_list=true + break + done < "$DOTFILES_LIST" +fi + +if [[ "$_has_external_list" == true ]]; then + DOTFILES=() while IFS= read -r line || [[ -n "$line" ]]; do [[ "$line" =~ ^#.*$ || -z "$line" ]] && continue DOTFILES+=("$line") -- cgit v1.2.3