Tree file management strategy and file backups #3

Merged
jutty merged 13 commits from file-copy into main 2024-09-03 17:14:39 +02:00
2 changed files with 9 additions and 4 deletions
Showing only changes of commit 005638bef4 - Show all commits

View file

@ -47,8 +47,7 @@ file_merge_tree() {
local prompt_verb="In configuration only"
local prompt_options="Copy to system"
fi
strategy="$(ask "$prompt_verb: $(tildify "$absolute_path")" "$prompt_options")" ||
file_merge_tree "$base_files"
strategy="$(ask "$prompt_verb: $(tildify "$absolute_path")" "$prompt_options")"
log debug "[merge_tree] Chosen strategy: $strategy"
if [ "$strategy" -eq 0 ]; then
@ -65,6 +64,7 @@ file_merge_tree() {
return 1
else
log user 'Invalid choice'
return 1
fi
fi
done

View file

@ -76,10 +76,15 @@ ask() {
read -r read_answer
answer="$(echo "$read_answer" | xargs)"
if [ "$answer" -ge 0 ] 2> /dev/null && [ "$answer" -le $options_count ]; then
if [ -z "$answer" ]; then
log info "[ask] Invalid choice"
echo -1
return 1
elif [ "$answer" -ge 0 ] 2> /dev/null && [ "$answer" -le $options_count ]; then
echo "$answer"
else
log debug "[ask] Invalid choice"
log info "[ask] Invalid choice"
echo -1
return 1
fi
}