mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-01-08 19:53:41 +08:00
cf8a24deed
When calling `omf destroy`, the `bundle` file is completely erased because we are calling `remove_package` on each installed package. We don't want to erase that file, we just want to emit the event and later on remove the code, which is done with `rm -rf "$OMF_PATH"`.
25 lines
612 B
Fish
25 lines
612 B
Fish
function omf.destroy -d "Remove Oh My Fish"
|
|
echo (omf::dim)"Removing Oh My Fish..."(omf::off)
|
|
|
|
for pkg in (basename $OMF_PATH/pkg/*)
|
|
emit uninstall_$pkg
|
|
end
|
|
|
|
set -l fish_config $XDG_CONFIG_HOME/fish
|
|
if test "$fish_config" = "/fish"
|
|
set fish_config $HOME/.config/fish
|
|
end
|
|
|
|
set -l localbackup (find $fish_config -regextype posix-extended -regex '^.*fish/config\.[[:digit:]]+\.copy$' |\
|
|
sort -r |head -1)
|
|
if test -n $localbackup
|
|
mv $localbackup "$fish_config/config.fish"
|
|
end
|
|
|
|
if test "$OMF_PATH" != "$HOME"
|
|
rm -rf "$OMF_PATH"
|
|
end
|
|
|
|
set -q CI; or exec fish < /dev/tty
|
|
end
|