Reduce number of universal variables

This commit is contained in:
Ilan Cosman 2021-05-18 15:00:49 -07:00
parent ba103857c8
commit 5659392f93
4 changed files with 22 additions and 30 deletions

View File

@ -1,23 +1,9 @@
function _tide_init_install --on-event _tide_init_install
set -U _tide_var_list
set -U tide_os_icon (_tide_detect_os)
set -U VIRTUAL_ENV_DISABLE_PROMPT true
set -U _tide_var_list tide_os_icon VIRTUAL_ENV_DISABLE_PROMPT
# Tiny improvment to shell startup, which makes async faster
function _tide_set -a var_name
set -U $var_name $argv[2..-1]
set -a _tide_var_list $var_name
end
_tide_set _tide_color_dark_blue 0087AF
_tide_set _tide_color_dark_green 5FAF00
_tide_set _tide_color_gold D7AF00
_tide_set _tide_color_green 5FD700
_tide_set _tide_color_light_blue 00AFFF
_tide_set _tide_root (status dirname)/..
_tide_set tide_os_icon (_tide_detect_os)
_tide_set VIRTUAL_ENV_DISABLE_PROMPT true
source $_tide_root/functions/tide/configure/choices/all/style.fish
source $_tide_root/functions/tide/configure/choices/all/finish.fish
source (functions --details _tide_sub_configure)
_load_config lean
_tide_finish
set -a _tide_var_list (set --names | string match --regex "^tide.*")

View File

@ -1,19 +1,25 @@
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
for file in (status dirname)/tide/configure/{choices, functions, prompt_items}/**.fish
source "$file"
end
function _tide_sub_configure
if test $COLUMNS -lt 55 -o $LINES -lt 21
printf '%s\n' 'Terminal size too small; must be at least 55 x 21'
return 1
end
# Create an empty fake function for each item
for func in _fake(functions --all | string match --entire _tide_item)
function $func
end
end
for file in $_tide_root/functions/tide/configure/{choices, functions, prompt_items}/**.fish
source "$file"
end
set -g fake_columns $COLUMNS
test $fake_columns -gt 90 && set fake_columns 90
set -g fake_lines $LINES

View File

@ -29,5 +29,5 @@ function style
end
function _load_config -a name
string replace --regex '^' 'set -g fake_' <$_tide_root/functions/tide/configure/configs/$name.fish | source
string replace --regex '^' 'set -g fake_' <(status dirname)/../../configs/$name.fish | source
end

View File

@ -6,4 +6,4 @@ end
_decolor red # CHECK: Hello Foo
_decolor normal # CHECK: Hello Foo
_decolor $_tide_color_gold # CHECK: Hello Foo
_decolor D7AF00 # CHECK: Hello Foo