oh-my-fish/pkg/omf/cli/omf.destroy.fish
Bruno Pinto 319c8a05cd Don't overwrite function on test environment
Instead of overwriting functions that use `exec fish` on test
environment, skip this call if the variable `CI` has been defined on the
running shell.
2015-10-02 23:50:18 +01:00

25 lines
631 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/*)
omf.remove_package $pkg >/dev/null ^&1
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