Dictionary-like configuration

This commit is contained in:
Ilan Cosman 2023-08-06 17:19:07 -07:00
parent 8bc67b570a
commit 3da41a845f
17 changed files with 56 additions and 52 deletions

View File

@ -44,7 +44,8 @@ function _tide_title -a text
end
function _tide_option -a symbol text
set -ga _tide_option_list $symbol
set -ga _tide_symbol_list $symbol
set -ga _tide_option_list $text
set_color -o
echo "($symbol) $text"
@ -61,21 +62,24 @@ function _tide_menu
echo '(q) Quit and do nothing'\n
while read --nchars 1 --prompt-str \
"$(set_color -o)Choice [$(string join '/' $_tide_option_list $r q)] $(set_color normal)" input
"$(set_color -o)Choice [$(string join '/' $_tide_symbol_list $r q)] $(set_color normal)" input
switch $input
case r
set -q _flag_no_restart && continue
set -e _tide_symbol_list
set -e _tide_option_list
_next_choice all/style
break
case q
set -e _tide_selected_option # Skip through all the _next_choices
set -e _tide_symbol_list
set -e _tide_option_list
command -q clear && clear
break
case $_tide_option_list
case $_tide_symbol_list
set -g _tide_selected_option $_tide_option_list[(contains -i $input $_tide_symbol_list)]
set -e _tide_symbol_list
set -e _tide_option_list
set -g _tide_selected_option $input
break
end
end

View File

@ -8,7 +8,7 @@ function finish
_tide_menu
switch $_tide_selected_option
case y
case Yes
_tide_finish
command -q clear && clear
end

View File

@ -10,7 +10,7 @@ function icons
_tide_menu
switch $_tide_selected_option
case 1
case 'Few icons'
_disable_icons
end
_next_choice all/finish

View File

@ -11,7 +11,7 @@ function prompt_colors
_tide_menu
switch $_tide_selected_option
case 1
case 'True color'
_load_config "$_tide_configure_style"
set -e _tide_16color
switch $_tide_configure_style
@ -20,7 +20,7 @@ function prompt_colors
case classic
_next_choice classic/classic_prompt_color
end
case 2
case '16 colors'
_next_choice all/show_time
end
end

View File

@ -12,11 +12,11 @@ function prompt_connection
_tide_menu
switch $_tide_selected_option
case 1
case Disconnected
set -g fake_tide_prompt_icon_connection ' '
case 2
case Dotted
set -g fake_tide_prompt_icon_connection '·'
case 3
case Solid
set -g fake_tide_prompt_icon_connection '─'
end
switch $_tide_configure_style

View File

@ -23,13 +23,13 @@ function prompt_connection_andor_frame_color
_tide_menu
switch $_tide_selected_option
case 1
case Lightest
set -g fake_tide_prompt_color_frame_and_connection 808080
case 2
case Light
set -g fake_tide_prompt_color_frame_and_connection 6C6C6C
case 3
case Dark
set -g fake_tide_prompt_color_frame_and_connection 585858
case 4
case Darkest
set -g fake_tide_prompt_color_frame_and_connection 444444
end
_next_choice all/prompt_spacing

View File

@ -12,9 +12,9 @@ function prompt_spacing
_tide_menu
switch $_tide_selected_option
case 1
case Compact
set -g fake_tide_prompt_add_newline_before false
case 2
case Sparse
set -g fake_tide_prompt_add_newline_before true
end
_next_choice all/icons

View File

@ -14,12 +14,12 @@ function show_time
_tide_menu
switch $_tide_selected_option
case 1
case No
set -g fake_tide_time_format ''
set -e fake_tide_right_prompt_items[-1]
case 2
case '24-hour format'
set -g fake_tide_time_format %T
case 3
case '12-hour format'
set -g fake_tide_time_format '%r'
end
switch $_tide_configure_style

View File

@ -15,13 +15,13 @@ function style
_tide_menu --no-restart
switch $_tide_selected_option
case 1
case Lean
_load_config lean
set -g _tide_configure_style lean
case 2
case Classic
_load_config classic
set -g _tide_configure_style classic
case 3
case Rainbow
_load_config rainbow
set -g _tide_configure_style rainbow
end

View File

@ -19,13 +19,13 @@ function classic_prompt_color
_tide_menu
switch $_tide_selected_option
case 1
case Lightest
_set_all_items_bg_color 585858
case 2
case Light
_set_all_items_bg_color 444444
case 3
case Dark
_set_all_items_bg_color 303030
case 4
case Darkest
_set_all_items_bg_color 1C1C1C
end
_next_choice all/show_time

View File

@ -23,16 +23,16 @@ function classic_prompt_separators
_tide_menu
switch $_tide_selected_option
case 1
case Angled
set -g fake_tide_left_prompt_separator_same_color
set -g fake_tide_right_prompt_separator_same_color
case 2
case Vertical
set -g fake_tide_left_prompt_separator_same_color '│'
set -g fake_tide_right_prompt_separator_same_color '│'
case 3
case Slanted
set -g fake_tide_left_prompt_separator_same_color ''
set -g fake_tide_right_prompt_separator_same_color ''
case 4
case Round
set -g fake_tide_left_prompt_separator_same_color ''
set -g fake_tide_right_prompt_separator_same_color ''
end

View File

@ -13,11 +13,11 @@ function lean_prompt_height
_tide_menu
switch $_tide_selected_option
case 1
case 'One line'
_tide_find_and_remove newline fake_tide_left_prompt_items
set fake_tide_left_prompt_suffix ''
_next_choice all/prompt_connection_andor_frame_color
case 2
case 'Two lines'
_tide_find_and_remove newline fake_tide_left_prompt_items
set -g fake_tide_left_prompt_items $fake_tide_left_prompt_items[1..-2] newline $fake_tide_left_prompt_items[-1]
set -g fake_tide_left_prompt_suffix ' '

View File

@ -27,18 +27,18 @@ function powerline_prompt_frame
_tide_menu
switch $_tide_selected_option
case 1
case 'No frame'
set fake_tide_left_prompt_frame_enabled false
set fake_tide_right_prompt_frame_enabled false
set -a fake_tide_left_prompt_items character
case 2
case Left
set fake_tide_left_prompt_frame_enabled true
set fake_tide_right_prompt_frame_enabled false
case 3
case Right
set fake_tide_left_prompt_frame_enabled false
set fake_tide_right_prompt_frame_enabled true
set -a fake_tide_left_prompt_items character
case 4
case Full
set fake_tide_left_prompt_frame_enabled true
set fake_tide_right_prompt_frame_enabled true
end

View File

@ -23,16 +23,16 @@ function powerline_prompt_heads
_tide_menu
switch $_tide_selected_option
case 1
case Sharp
set -g fake_tide_left_prompt_suffix
set -g fake_tide_right_prompt_prefix
case 2
case Blurred
set -g fake_tide_left_prompt_suffix '▓▒░'
set -g fake_tide_right_prompt_prefix '░▒▓'
case 3
case Slanted
set -g fake_tide_left_prompt_suffix ''
set -g fake_tide_right_prompt_prefix ''
case 4
case Round
set -g fake_tide_left_prompt_suffix ''
set -g fake_tide_right_prompt_prefix ''
end

View File

@ -15,12 +15,12 @@ function powerline_prompt_height
_tide_menu
switch $_tide_selected_option
case 1
case 'One line'
_tide_find_and_remove newline fake_tide_left_prompt_items
set fake_tide_left_prompt_frame_enabled false
set fake_tide_right_prompt_frame_enabled false
_next_choice all/prompt_connection_andor_frame_color
case 2
case 'Two lines'
_tide_find_and_remove newline fake_tide_left_prompt_items
set -g fake_tide_left_prompt_items $fake_tide_left_prompt_items newline
set fake_tide_left_prompt_frame_enabled true

View File

@ -28,19 +28,19 @@ function powerline_prompt_tails
_tide_menu
switch $_tide_selected_option
case 1
case Flat
set -g fake_tide_left_prompt_prefix ''
set -g fake_tide_right_prompt_suffix ''
case 2
case Blurred
set -g fake_tide_left_prompt_prefix '░▒▓'
set -g fake_tide_right_prompt_suffix '▓▒░'
case 3
case Sharp
set -g fake_tide_left_prompt_prefix
set -g fake_tide_right_prompt_suffix
case 4
case Slanted
set -g fake_tide_left_prompt_prefix ''
set -g fake_tide_right_prompt_suffix ''
case 5
case Round
set -g fake_tide_left_prompt_prefix ''
set -g fake_tide_right_prompt_suffix ''
end

View File

@ -23,16 +23,16 @@ function rainbow_prompt_separators
_tide_menu
switch $_tide_selected_option
case 1
case Angled
set -g fake_tide_left_prompt_separator_diff_color
set -g fake_tide_right_prompt_separator_diff_color
case 2
case Vertical
set -g fake_tide_left_prompt_separator_diff_color ''
set -g fake_tide_right_prompt_separator_diff_color ''
case 3
case Slanted
set -g fake_tide_left_prompt_separator_diff_color ''
set -g fake_tide_right_prompt_separator_diff_color ''
case 4
case Round
set -g fake_tide_left_prompt_separator_diff_color ''
set -g fake_tide_right_prompt_separator_diff_color ''
end