Error for missing/invalid auto configures

This commit is contained in:
Ilan Cosman 2023-09-17 20:29:27 -07:00
parent 9252158e4f
commit c0fd6a2f85
2 changed files with 18 additions and 5 deletions

View File

@ -69,8 +69,17 @@ function _tide_menu -a func
if set -q _flag_auto
set -l flag_var_name _flag_$func
set -g _tide_selected_option $$flag_var_name
set -e _tide_symbol_list
set -e _tide_option_list
if test -z "$_tide_selected_option"
echo "Missing input for choice '$func'"
_tide_exit_configure
else if not contains $_tide_selected_option $_tide_option_list
echo "Invalid input '$_tide_selected_option' for choice '$func'"
_tide_exit_configure
else
set -e _tide_symbol_list
set -e _tide_option_list
end
return
end
@ -92,7 +101,7 @@ function _tide_menu -a func
_next_choice all/style
break
case q
set -e _tide_selected_option # Skip through all the _next_choices
_tide_exit_configure
set -e _tide_symbol_list
set -e _tide_option_list
command -q clear && clear
@ -123,3 +132,7 @@ function _tide_display_prompt -a var_name var_value
set_color normal
echo
end
function _tide_exit_configure
set -e _tide_selected_option # Skip through all switch and _next_choice
end

View File

@ -17,14 +17,14 @@ function finish
command -q clear && clear
_tide_print_configure_current_options
case 'Exit and print the config you just generated'
set -e _tide_selected_option # Skip through all the _next_choices
_tide_exit_configure
command -q clear && clear
_tide_print_configure_current_options
end
end
function _tide_finish
set -e _tide_selected_option # Skip through all the _next_choices
_tide_exit_configure
# Deal with prompt char/vi mode
contains character $fake_tide_left_prompt_items || set -p fake_tide_left_prompt_items vi_mode