2021-05-19 01:00:49 +03:00
|
|
|
set -g _tide_color_dark_blue 0087AF
|
|
|
|
set -g _tide_color_dark_green 5FAF00
|
|
|
|
set -g _tide_color_gold D7AF00
|
|
|
|
set -g _tide_color_green 5FD700
|
|
|
|
set -g _tide_color_light_blue 00AFFF
|
|
|
|
|
|
|
|
# Create an empty fake function for each item
|
|
|
|
for func in _fake(functions --all | string match --entire _tide_item)
|
|
|
|
function $func
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-05-23 06:51:21 +03:00
|
|
|
for file in (status dirname)/tide/configure/{choices, functions}/**.fish
|
|
|
|
source $file
|
2021-05-19 01:00:49 +03:00
|
|
|
end
|
|
|
|
|
2020-07-15 04:30:58 +03:00
|
|
|
function _tide_sub_configure
|
2020-12-28 08:12:30 +03:00
|
|
|
if test $COLUMNS -lt 55 -o $LINES -lt 21
|
2021-09-08 20:54:31 +03:00
|
|
|
echo 'Terminal size too small; must be at least 55 x 21'
|
2020-04-20 19:38:41 +03:00
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
2021-11-16 21:22:41 +03:00
|
|
|
_tide_detect_os | read -g --line os_branding_icon os_branding_color os_branding_bg_color
|
|
|
|
|
2020-05-19 02:17:50 +03:00
|
|
|
set -g fake_columns $COLUMNS
|
2020-11-25 01:39:56 +03:00
|
|
|
test $fake_columns -gt 90 && set fake_columns 90
|
2020-05-19 02:17:50 +03:00
|
|
|
set -g fake_lines $LINES
|
2020-04-28 01:37:08 +03:00
|
|
|
|
2021-01-23 04:28:48 +03:00
|
|
|
set -g _tide_selected_option
|
2021-03-02 20:46:40 +03:00
|
|
|
_next_choice all/style
|
2020-04-20 19:38:41 +03:00
|
|
|
end
|
|
|
|
|
2020-05-19 02:17:50 +03:00
|
|
|
function _next_choice -a nextChoice
|
2021-07-18 00:33:31 +03:00
|
|
|
set -q _tide_selected_option || return 0
|
2020-06-18 20:36:59 +03:00
|
|
|
set -l cmd (string split '/' $nextChoice)[2]
|
|
|
|
$cmd
|
2020-04-20 19:38:41 +03:00
|
|
|
end
|
|
|
|
|
2020-07-19 23:35:19 +03:00
|
|
|
function _tide_title -a text
|
2022-03-14 17:10:29 +03:00
|
|
|
command -q clear && clear
|
2020-04-21 21:52:24 +03:00
|
|
|
set_color -o
|
2021-03-14 06:20:33 +03:00
|
|
|
string pad --width (math --scale=0 "$fake_columns/2" + (string length $text)/2) $text
|
2020-04-21 21:52:24 +03:00
|
|
|
set_color normal
|
|
|
|
end
|
|
|
|
|
2020-07-19 23:35:19 +03:00
|
|
|
function _tide_option -a symbol text
|
|
|
|
set -ga _tide_option_list $symbol
|
2020-07-15 05:10:59 +03:00
|
|
|
|
2020-04-21 21:52:24 +03:00
|
|
|
set_color -o
|
2021-09-08 20:54:31 +03:00
|
|
|
echo "($symbol) $text"
|
2020-04-21 21:52:24 +03:00
|
|
|
set_color normal
|
2020-04-20 19:38:41 +03:00
|
|
|
end
|
|
|
|
|
2020-12-28 08:12:30 +03:00
|
|
|
function _tide_menu
|
2021-05-12 23:13:51 +03:00
|
|
|
set -l list_with_slashes (string join '/' $_tide_option_list)
|
2020-04-20 19:38:41 +03:00
|
|
|
|
2021-09-08 20:54:31 +03:00
|
|
|
echo '(r) Restart from the beginning'
|
|
|
|
echo '(q) Quit and do nothing'\n
|
2020-07-19 23:35:19 +03:00
|
|
|
|
2020-12-28 08:12:30 +03:00
|
|
|
while true
|
|
|
|
set_color -o
|
2021-08-22 00:59:45 +03:00
|
|
|
read --nchars 1 --prompt-str "Choice [$list_with_slashes/r/q] " input
|
2020-12-28 08:12:30 +03:00
|
|
|
set_color normal
|
|
|
|
|
|
|
|
switch $input
|
|
|
|
case r
|
|
|
|
set -e _tide_option_list
|
2021-03-02 20:46:40 +03:00
|
|
|
_next_choice all/style
|
2020-12-28 08:12:30 +03:00
|
|
|
break
|
|
|
|
case q
|
2021-01-23 04:28:48 +03:00
|
|
|
set -e _tide_selected_option # Skip through all the _next_choices
|
2020-12-28 08:46:22 +03:00
|
|
|
set -e _tide_option_list
|
2022-03-14 17:10:29 +03:00
|
|
|
command -q clear && clear
|
2020-12-28 08:12:30 +03:00
|
|
|
break
|
|
|
|
case $_tide_option_list
|
|
|
|
set -e _tide_option_list
|
|
|
|
set -g _tide_selected_option $input
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
2020-04-20 19:38:41 +03:00
|
|
|
end
|
|
|
|
|
2020-12-28 08:12:30 +03:00
|
|
|
function _tide_display_prompt -a var_name var_value
|
|
|
|
test -n "$var_name" && set -g $var_name $var_value
|
2021-10-15 00:16:29 +03:00
|
|
|
_fake_tide_cache_variables
|
2021-10-15 03:32:48 +03:00
|
|
|
set -l prompt (_fake_tide_prompt)
|
|
|
|
|
|
|
|
set -l bottom_left_prompt_string_length (string length --visible $prompt[-1])
|
|
|
|
set -l right_prompt_string (string pad --width (math $fake_columns-$bottom_left_prompt_string_length) $prompt[1])
|
|
|
|
set -l prompt[-1] "$prompt[-1]$right_prompt_string"
|
|
|
|
|
|
|
|
string unescape $prompt[2..]
|
|
|
|
set_color normal
|
|
|
|
echo
|
2020-11-20 03:23:54 +03:00
|
|
|
end
|