Tree file management strategy and file backups #3
2 changed files with 9 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue