tide/tide_theme/functions/uninstall.fish

55 lines
1.6 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-05-19 06:03:25 +03:00
set -a tideFunctions 'tide'
set -a tideFunctions 'tide_'{'decolor', 'left_prompt', 'right_prompt'}
set -a tideFunctions '_tide_'{'cmd_duration', 'context', 'git_prompt', 'jobs', 'newline', 'prompt_char', 'pwd', 'status', 'time'}
for func in $tideFunctions
2020-05-04 08:36:33 +03:00
rm "$__fish_config_dir/functions/$func.fish"
end
2020-05-19 06:03:25 +03:00
set -a tideConfd 'tide_'{'count_left_prompt_height', 'cursor_movement'}
for file in $tideConfd
2020-05-19 05:47:12 +03:00
rm "$__fish_config_dir/conf.d/$file.fish"
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