2020-05-19 06:03:25 +03:00
|
|
|
function tide_uninstall
|
|
|
|
if not _user_confirm_defaultNo 'Uninstall tide theme?'
|
2020-05-04 08:36:33 +03:00
|
|
|
echo 'Aborted uninstall.'
|
|
|
|
return 1
|
|
|
|
end
|
2020-05-19 06:03:25 +03:00
|
|
|
echo 'Uninstalling tide theme...'
|
2020-04-29 07:19:32 +03:00
|
|
|
|
2020-05-04 08:36:33 +03:00
|
|
|
set -l fishPrompt (functions -D fish_prompt)
|
2020-04-29 07:19:32 +03:00
|
|
|
|
2020-05-04 08:36:33 +03:00
|
|
|
# ----------------------------------Remove Files----------------------------------
|
2020-05-19 06:03:25 +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-04-26 00:52:39 +03:00
|
|
|
|
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-04-26 00:52:39 +03:00
|
|
|
|
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------------------------------
|
|
|
|
set -l rmVars \
|
2020-05-13 23:27:52 +03:00
|
|
|
# ---------------General Theme Variables---------------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide'{'dir', 'newline'} \
|
2020-04-15 03:52:21 +03:00
|
|
|
# --------------Colors--------------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide_color_'{'green', 'light_blue', 'dark_blue', 'gold', 'lilac'} \
|
2020-05-13 23:27:52 +03:00
|
|
|
# ---------Prompt Connection---------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide_prompt_connection_'{'icon', 'color'} \
|
2020-05-13 23:27:52 +03:00
|
|
|
# --------------------Prompt Items--------------------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide_'{'right_prompt_items', 'left_prompt_items', 'left_prompt_height'} \
|
2020-05-13 23:27:52 +03:00
|
|
|
# ----------------Pwd----------------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide_pwd_'{'shorten_margin', 'unwritable_icon'} \
|
2020-04-15 03:52:21 +03:00
|
|
|
# ------------Git prompt------------
|
2020-05-09 01:32:58 +03:00
|
|
|
'__fish_git_prompt_'{'show_informative_status', 'showstashstate'} \
|
2020-04-15 03:52:21 +03:00
|
|
|
# -------Symbols-------
|
2020-05-19 06:03:25 +03:00
|
|
|
'__fish_git_prompt_char_'{'stateseparator', 'ctidestate', 'upstream_ahead', 'upstream_behind'} \
|
2020-05-09 01:32:58 +03:00
|
|
|
'__fish_git_prompt_char_'{'stagedstate', 'dirtystate', 'untrackedfiles', 'stashstate'} \
|
2020-04-15 03:52:21 +03:00
|
|
|
# --------Colors--------
|
2020-05-09 01:32:58 +03:00
|
|
|
'__fish_git_prompt_color_'{'branch', 'upstream', 'stagedstate', 'dirtystate', 'untrackedfiles', 'stashstate'} \
|
2020-04-29 22:32:59 +03:00
|
|
|
# --------------Status--------------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide_status_'{'success_icon', 'success_color', 'failure_icon', 'failure_color'} \
|
2020-05-04 08:36:33 +03:00
|
|
|
# ------------Cmd_Duration-----------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide_cmd_duration_'{'color', 'decimals', 'threshold'} \
|
2020-05-04 08:36:33 +03:00
|
|
|
# ----------------SSH----------------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide_context_'{'ssh_color', 'root_color'} \
|
2020-04-29 07:19:32 +03:00
|
|
|
# ---------------Jobs---------------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide_jobs_'{'icon', 'color'} \
|
2020-04-30 05:19:17 +03:00
|
|
|
# ---------------Time---------------
|
2020-05-19 06:03:25 +03:00
|
|
|
'tide_time_'{'format', 'color'}
|
2020-04-15 03:52:21 +03:00
|
|
|
|
2020-05-04 08:36:33 +03:00
|
|
|
for var in $rmVars
|
|
|
|
set -e $var
|
2020-04-13 02:58:24 +03:00
|
|
|
end
|
2020-05-04 08:36:33 +03:00
|
|
|
|
2020-05-19 06:03:25 +03:00
|
|
|
echo 'Tide theme uninstalled.'
|
2020-04-22 06:06:05 +03:00
|
|
|
end
|
|
|
|
|
2020-04-26 00:52:39 +03:00
|
|
|
function _user_confirm_defaultNo -a question
|
2020-04-22 06:06:05 +03:00
|
|
|
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
|
2020-04-13 02:58:24 +03:00
|
|
|
end
|