mirror of
https://github.com/IlanCosman/tide.git
synced 2024-09-11 17:15:34 +03:00
Mostly working auto configure
This commit is contained in:
parent
3da41a845f
commit
78ce8032be
@ -15,9 +15,18 @@ for file in (status dirname)/tide/configure/{choices, functions}/**.fish
|
||||
end
|
||||
|
||||
function _tide_sub_configure
|
||||
if test $COLUMNS -lt 55 -o $LINES -lt 21
|
||||
echo 'Terminal size too small; must be at least 55 x 21'
|
||||
return 1
|
||||
set -l choices (path basename (status dirname)/tide/configure/choices/**.fish | path change-extension '')
|
||||
argparse auto $choices= -- $argv
|
||||
|
||||
for var in (set -l --names | string match -e _flag)
|
||||
set -x $var $$var
|
||||
end
|
||||
|
||||
if set -q _flag_auto
|
||||
if test $COLUMNS -lt 55 -o $LINES -lt 21
|
||||
echo 'Terminal size too small; must be at least 55 x 21'
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
_tide_detect_os | read -g --line os_branding_icon os_branding_color os_branding_bg_color
|
||||
@ -37,6 +46,8 @@ function _next_choice -a nextChoice
|
||||
end
|
||||
|
||||
function _tide_title -a text
|
||||
set -q _flag_auto && return
|
||||
|
||||
command -q clear && clear
|
||||
set_color -o
|
||||
string pad --width (math --scale=0 "$fake_columns/2" + (string length $text)/2) $text
|
||||
@ -47,12 +58,22 @@ function _tide_option -a symbol text
|
||||
set -ga _tide_symbol_list $symbol
|
||||
set -ga _tide_option_list $text
|
||||
|
||||
set_color -o
|
||||
echo "($symbol) $text"
|
||||
set_color normal
|
||||
if not set -q _flag_auto
|
||||
set_color -o
|
||||
echo "($symbol) $text"
|
||||
set_color normal
|
||||
end
|
||||
end
|
||||
|
||||
function _tide_menu
|
||||
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
|
||||
return
|
||||
end
|
||||
|
||||
argparse no-restart -- $argv # Add no-restart option for first menu
|
||||
|
||||
if not set -q _flag_no_restart
|
||||
@ -86,6 +107,8 @@ function _tide_menu
|
||||
end
|
||||
|
||||
function _tide_display_prompt -a var_name var_value
|
||||
set -q _flag_auto && return
|
||||
|
||||
test -n "$var_name" && set -g $var_name $var_value
|
||||
_fake_tide_cache_variables
|
||||
set -l prompt (_fake_tide_prompt)
|
||||
|
@ -6,7 +6,7 @@ function finish
|
||||
_tide_option y Yes
|
||||
echo
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case Yes
|
||||
_tide_finish
|
||||
|
@ -8,7 +8,7 @@ function icons
|
||||
_enable_icons
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case 'Few icons'
|
||||
_disable_icons
|
||||
|
@ -9,7 +9,7 @@ function prompt_colors
|
||||
set -g _tide_16color true
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case 'True color'
|
||||
_load_config "$_tide_configure_style"
|
||||
|
@ -10,7 +10,7 @@ function prompt_connection
|
||||
_tide_option 3 Solid
|
||||
_tide_display_prompt fake_tide_prompt_icon_connection '─'
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case Disconnected
|
||||
set -g fake_tide_prompt_icon_connection ' '
|
||||
|
@ -21,7 +21,7 @@ function prompt_connection_andor_frame_color
|
||||
_tide_option 4 Darkest
|
||||
_tide_display_prompt fake_tide_prompt_color_frame_and_connection 444444
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case Lightest
|
||||
set -g fake_tide_prompt_color_frame_and_connection 808080
|
||||
|
@ -10,7 +10,7 @@ function prompt_spacing
|
||||
_tide_display_prompt
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case Compact
|
||||
set -g fake_tide_prompt_add_newline_before false
|
||||
|
@ -12,7 +12,7 @@ function show_time
|
||||
_tide_option 3 '12-hour format'
|
||||
_tide_display_prompt fake_tide_time_format '%r'
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case No
|
||||
set -g fake_tide_time_format ''
|
||||
|
@ -13,7 +13,7 @@ function style
|
||||
_load_config rainbow
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu --no-restart
|
||||
_tide_menu (status function) --no-restart
|
||||
switch $_tide_selected_option
|
||||
case Lean
|
||||
_load_config lean
|
||||
|
@ -17,7 +17,7 @@ function classic_prompt_color
|
||||
_set_all_items_bg_color 1C1C1C
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case Lightest
|
||||
_set_all_items_bg_color 585858
|
||||
|
@ -21,7 +21,7 @@ function classic_prompt_separators
|
||||
set -g fake_tide_right_prompt_separator_same_color ''
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case Angled
|
||||
set -g fake_tide_left_prompt_separator_same_color
|
||||
|
@ -11,7 +11,7 @@ function lean_prompt_height
|
||||
set -g fake_tide_left_prompt_suffix ' '
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case 'One line'
|
||||
_tide_find_and_remove newline fake_tide_left_prompt_items
|
||||
|
@ -25,7 +25,7 @@ function powerline_prompt_frame
|
||||
set fake_tide_right_prompt_frame_enabled true
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case 'No frame'
|
||||
set fake_tide_left_prompt_frame_enabled false
|
||||
|
@ -21,7 +21,7 @@ function powerline_prompt_heads
|
||||
set -g fake_tide_right_prompt_prefix ''
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case Sharp
|
||||
set -g fake_tide_left_prompt_suffix
|
||||
|
@ -13,7 +13,7 @@ function powerline_prompt_height
|
||||
set fake_tide_right_prompt_frame_enabled true
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case 'One line'
|
||||
_tide_find_and_remove newline fake_tide_left_prompt_items
|
||||
|
@ -26,7 +26,7 @@ function powerline_prompt_tails
|
||||
set -g fake_tide_right_prompt_suffix ''
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case Flat
|
||||
set -g fake_tide_left_prompt_prefix ''
|
||||
|
@ -21,7 +21,7 @@ function rainbow_prompt_separators
|
||||
set -g fake_tide_right_prompt_separator_diff_color ''
|
||||
_tide_display_prompt
|
||||
|
||||
_tide_menu
|
||||
_tide_menu (status function)
|
||||
switch $_tide_selected_option
|
||||
case Angled
|
||||
set -g fake_tide_left_prompt_separator_diff_color
|
||||
|
Loading…
Reference in New Issue
Block a user