diff --git a/src/file/file_merge.sh b/src/file/file_merge.sh index 97075d7..7bf25dc 100644 --- a/src/file/file_merge.sh +++ b/src/file/file_merge.sh @@ -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 diff --git a/src/utility.sh b/src/utility.sh index 79afd4d..b342897 100644 --- a/src/utility.sh +++ b/src/utility.sh @@ -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 }