Merge pull request #48 from jeremiejig/fixomfdestroy

Fixes on omf destroy and omf.remove_package
This commit is contained in:
Bruno 2015-09-26 22:39:18 +01:00
commit 61019c7378
3 changed files with 50 additions and 42 deletions

View File

@ -1,10 +1,19 @@
function omf.destroy -d "Remove Oh My Fish"
echo (omf::dim)"Removing Oh My Fish..."(omf::off)
omf.remove_package (basename $OMF_PATH/pkg/*) >/dev/null ^&1
for pkg in (basename $OMF_PATH/pkg/*)
omf.remove_package $pkg >/dev/null ^&1
end
if test -e "$HOME/.config/fish/config.copy"
mv "$HOME/.config/fish/config".{copy,fish}
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"

View File

@ -1,6 +1,6 @@
function omf.remove_package
for pkg in $argv
set -l pkg $argv
set -l remove_status 1
if not omf.util_valid_package $pkg
@ -37,9 +37,8 @@ function omf.remove_package
if test $remove_status -eq 0
echo (omf::em)"$pkg successfully removed."(omf::off)
refresh
else
echo (omf::err)"$pkg could not be found"(omf::off) 1^&2
end
end
return $remove_status
end

View File

@ -120,7 +120,7 @@ function omf -d "Oh My Fish"
echo "Usage: $_ "(omf::em)"$argv[1]"(omf::off)" <[package|theme] name>" 1^&2
return $OMF_INVALID_ARG
end
omf.remove_package $argv[2..-1]
omf.remove_package $argv[2] ; and refresh
case "u" "up" "upd" "update"
pushd $OMF_PATH