wizard now deletes all previous vars

This commit is contained in:
Ilan Cosman 2020-07-20 10:17:36 -07:00
parent 8c4dd87322
commit aa8a890a05
3 changed files with 33 additions and 29 deletions

View File

@ -11,20 +11,32 @@ function finish
switch (_tide_menu)
case y
if not contains 'prompt_char' $fake_tide_left_prompt_items # Without a prompt_char, the user won't know if a command failed/succeeded
set fake_tide_status_always_display_icon true # Therefore, set the status to always display
end
cat "$_tide_dir/configure/fish_prompt.fish" >"$__fish_config_dir/functions/fish_prompt.fish"
for normalVar in (string replace 'fake_' '' $fake_tide_var_list)
set fakeVar fake_$normalVar
set -U $normalVar $$fakeVar
end
set _tide_var_list $fake_tide_var_list
source "$__fish_config_dir/conf.d/_tide_Ω_init.fish" # Reload important startup variables
_tide_finish
end
_tide_quit
end
function _tide_finish
if not contains 'prompt_char' $fake_tide_left_prompt_items # Without a prompt_char, the user won't know if a command failed/succeeded
set fake_tide_status_always_display_icon true # Therefore, set the status to always display
end
cat "$_tide_dir/configure/fish_prompt.fish" >"$__fish_config_dir/functions/fish_prompt.fish"
# Delete all vars in _tide_var_list and all non fake fish_git_prompt vars
for var in $_tide_var_list (set -n | string match --invert --entire 'fake' | string match --entire fish_git_prompt)
set -e $var
end
set -l incomingVarList (string replace 'fake_' '' $fake__tide_var_list)
for normalVar in $incomingVarList
set -l fakeVar fake_$normalVar
set -U $normalVar $$fakeVar
end
set _tide_var_list $incomingVarList
source "$__fish_config_dir/conf.d/_tide_Ω_init.fish" # Reload important startup variables
end

View File

@ -40,16 +40,16 @@ function style
end
function _load_config -a name
for var in $fake_tide_var_list
for var in $fake__tide_var_list
set -e $var
end
set -g fake_tide_var_list
set -g fake__tide_var_list
source "$_tide_dir/configure/configs/$name.fish"
end
function _set -a var_name
set -g $var_name $argv[2..-1]
set -a fake_tide_var_list $var_name
set -a fake__tide_var_list $var_name
end

View File

@ -30,18 +30,13 @@ function _tide_actual_install
# --------------------Set Defaults--------------------
_set_immutables
set -U _tide_var_list
source "$_tide_dir/configure/choices/all/style.fish"
_load_config 'lean'
cat "$_tide_dir/configure/fish_prompt.fish" >"$__fish_config_dir/functions/fish_prompt.fish"
for normalVar in (string replace 'fake_' '' $fake_tide_var_list)
set fakeVar fake_$normalVar
set -U $normalVar $$fakeVar
end
set _tide_var_list $fake_tide_var_list
source "$__fish_config_dir/conf.d/_tide_Ω_init.fish" # Reload important startup variables
source "$_tide_dir/configure/choices/all/finish.fish"
_tide_finish
# -----------------------Finish-----------------------
for file in $_tide_file_list
@ -69,10 +64,7 @@ end
function _set_immutables
set -U _tide_var_immutable_list
_set_immutable _tide_file_list
for file in $tempDir/{completions/*, conf.d/*, functions/*}
set -a _tide_file_list (string replace "$tempDir/" '' "$file")
end
_set_immutable _tide_file_list (string replace "$tempDir/" '' $tempDir/{completions/*, conf.d/*, functions/*})
_set_immutable _tide_version 2.0.0
_set_immutable _tide_dir "$__fish_config_dir/tide_theme"