tide/lean_theme/functions/lean_uninstall.fish

72 lines
2.7 KiB
Fish
Raw Normal View History

2020-04-13 01:40:49 +03:00
function lean_uninstall
2020-05-04 07:41:08 +03:00
if _user_confirm_defaultNo 'Uninstall lean theme?'
2020-04-28 02:38:17 +03:00
set -l fishPrompt "$__fish_config_dir/functions/fish_prompt.fish"
2020-04-30 00:52:58 +03:00
echo 'Uninstalling lean theme...'
# ------------------Remove Files------------------
rm -r "$__fish_config_dir/lean_theme"
2020-04-13 01:40:49 +03:00
2020-04-28 02:38:17 +03:00
set -l fishPromptFirstLine (head -n 1 $fishPrompt)
2020-04-30 00:52:58 +03:00
if test "$fishPromptFirstLine" = '# Created by lean_wizard'
2020-04-28 02:38:17 +03:00
rm $fishPrompt
source "$__fish_data_dir/functions/fish_prompt.fish"
end
2020-04-28 01:37:08 +03:00
set -l leanFunctions git_prompt load_right_prompt_items pwd right_prompt uninstall wizard
for func in $leanFunctions
rm "$__fish_config_dir/functions/lean_$func.fish"
end
# --------------Erase Theme Variables--------------
2020-04-21 06:35:56 +03:00
# --------------Prompt--------------
set -a rmVars lean_prompt_connection_{icon, color}
2020-04-15 03:52:21 +03:00
# --------------Colors--------------
set -a rmVars lean_color_{green, light_blue, dark_blue, gold}
2020-04-15 03:52:21 +03:00
# ---------------Pwd---------------
set -a rmVars lean_pwd_{shorten_margin, unwritable_icon}
2020-04-15 03:52:21 +03:00
# ------------Git prompt------------
set -a rmVars __fish_git_prompt_{show_informative_status, showstashstate}
2020-04-15 03:52:21 +03:00
# -------Symbols-------
set -a rmVars __fish_git_prompt_char_{stateseparator, cleanstate, upstream_ahead, upstream_behind}
set -a rmVars __fish_git_prompt_char_{stagedstate, dirtystate, untrackedfiles, stashstate}
2020-04-15 03:52:21 +03:00
# --------Colors--------
set -a rmVars __fish_git_prompt_color_{branch, upstream, stagedstate, dirtystate, untrackedfiles, stashstate}
2020-04-28 01:37:08 +03:00
# ----------------Right Prompt Items----------------
set -a rmVars lean_right_prompt_items
2020-04-29 22:32:59 +03:00
# --------------Status--------------
set -a rmVars lean_status_{success_icon, success_color, failure_icon, failure_color}
# --------------Cmd_Duration--------------
set -a rmVars lean_cmd_duration_{color, decimals, duration}
# ---------------SSH---------------
set -a rmVars lean_context_{ssh_color, root_color}
# ---------------Jobs---------------
2020-04-29 19:53:39 +03:00
set -a rmVars lean_jobs_{icon, color}
2020-04-30 05:19:17 +03:00
# ---------------Time---------------
set -a rmVars lean_time_{format, color}
for var in $rmVars
2020-04-15 03:52:21 +03:00
set -e $var
end
2020-04-15 03:52:21 +03:00
2020-04-30 00:52:58 +03:00
echo 'Lean theme uninstalled.'
2020-04-15 03:52:21 +03:00
else
2020-04-30 00:52:58 +03:00
echo 'Aborted uninstall.'
end
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