Simplify removing unusable items

This commit is contained in:
Ilan Cosman 2021-03-17 22:23:01 -07:00
parent 9e7f04d82e
commit c5d7640415
2 changed files with 4 additions and 11 deletions

View File

@ -1,6 +1,4 @@
function _tide_remove_unusable_items
argparse f/fake -- $argv
# Remove tool-specific items for tools the machine doesn't have installed
for item in chruby git nvm php rust virtual_env
set -l cliName $item
@ -12,13 +10,8 @@ function _tide_remove_unusable_items
end
if not type -q $cliName
if set -q _flag_fake
_tide_find_and_remove $item fake_tide_left_prompt_items
_tide_find_and_remove $item fake_tide_right_prompt_items
else
_tide_find_and_remove $item tide_left_prompt_items
_tide_find_and_remove $item tide_right_prompt_items
end
_tide_find_and_remove $item tide_left_prompt_items
_tide_find_and_remove $item tide_right_prompt_items
end
end
end

View File

@ -17,8 +17,6 @@ function finish
end
function _tide_finish
_tide_remove_unusable_items --fake
# Deal with prompt char/vi mode
if contains prompt_char $fake_tide_left_prompt_items
_tide_find_and_remove vi_mode fake_tide_right_prompt_items
@ -36,4 +34,6 @@ function _tide_finish
for fakeVar in (set --names | string match --regex "^fake_tide.*")
set -U (string replace 'fake_' '' $fakeVar) $$fakeVar
end
_tide_remove_unusable_items
end