tide/tide_theme/functions/uninstall.fish

51 lines
1.3 KiB
Fish
Raw Normal View History

2020-05-19 06:03:25 +03:00
function tide_uninstall
if not _user_confirm_defaultNo 'Uninstall tide theme?'
2020-05-20 00:10:19 +03:00
printf '%s\n' 'Aborted uninstall.'
2020-05-04 08:36:33 +03:00
return 1
end
2020-05-20 00:10:19 +03:00
printf '%s\n' 'Uninstalling tide theme...'
2020-05-04 08:36:33 +03:00
set -l fishPrompt (functions -D fish_prompt)
2020-05-04 08:36:33 +03:00
# ----------------------------------Remove Files----------------------------------
2020-05-20 20:39:44 +03:00
if test -e $_tide_dir
rm -r $_tide_dir
2020-05-04 08:36:33 +03:00
end
2020-04-13 01:40:49 +03:00
2020-05-04 08:36:33 +03:00
set -l fishPromptFirstLine (head -n 1 $fishPrompt)
2020-05-19 06:03:25 +03:00
if test "$fishPromptFirstLine" = '# Created by tide configure'
2020-05-04 08:36:33 +03:00
rm $fishPrompt
source "$__fish_data_dir/functions/fish_prompt.fish"
end
2020-06-07 01:04:53 +03:00
for func in (cat "$__fish_config_dir/conf.d/_tide_Ω_run.fish")
functions -e $func
end
2020-05-22 08:11:20 +03:00
for file in $_tide_file_list
2020-05-25 01:37:09 +03:00
rm -f "$__fish_config_dir/$file"
2020-05-19 05:47:12 +03:00
end
2020-05-04 08:36:33 +03:00
# -----------------------------Erase Theme Variables------------------------------
2020-05-20 20:39:44 +03:00
for var in $_tide_var_list
2020-05-04 08:36:33 +03:00
set -e $var
end
2020-05-20 20:39:44 +03:00
set -e _tide_var_list
2020-05-04 08:36:33 +03:00
2020-05-20 00:10:19 +03:00
printf '%s\n' 'Tide theme uninstalled.'
end
function _user_confirm_defaultNo -a question
while true
read -P "$question [y/N] " input
switch $input
case y Y yes Yes
return 0
case n N no No
return 1
case ''
return 1
end
end
end