Fixing how omf remove work, and omf.remove_package

destroy was broken because of a premature refresh. (giving false hang
behaviour)
pull/48/head
jeremiejig 9 years ago
parent 3468654457
commit b9c1bd9576

@ -1,7 +1,9 @@
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}

@ -1,45 +1,44 @@
function omf.remove_package
for pkg in $argv
set -l remove_status 1
if not omf.util_valid_package $pkg
if test $pkg = "omf" -o $pkg = "default"
echo (omf::err)"You can't remove `$pkg`"(omf::off) 1^&2
else
echo (omf::err)"$pkg is not a valid package/theme name"(omf::off) 1^&2
end
return $OMF_INVALID_ARG
set -l pkg $argv
set -l remove_status 1
if not omf.util_valid_package $pkg
if test $pkg = "omf" -o $pkg = "default"
echo (omf::err)"You can't remove `$pkg`"(omf::off) 1^&2
else
echo (omf::err)"$pkg is not a valid package/theme name"(omf::off) 1^&2
end
return $OMF_INVALID_ARG
end
for path in {$OMF_PATH,$OMF_CONFIG}/{pkg}/$pkg
not test -d $path; and continue
for path in {$OMF_PATH,$OMF_CONFIG}/{pkg}/$pkg
not test -d $path; and continue
emit uninstall_$pkg
omf.bundle.remove "package" $pkg
emit uninstall_$pkg
omf.bundle.remove "package" $pkg
rm -rf $path
set remove_status $status
end
rm -rf $path
set remove_status $status
end
for path in {$OMF_PATH,$OMF_CONFIG}/{themes}/$pkg
not test -d $path; and continue
for path in {$OMF_PATH,$OMF_CONFIG}/{themes}/$pkg
not test -d $path; and continue
if test $pkg = (cat $OMF_CONFIG/theme)
echo default > $OMF_CONFIG/theme
end
if test $pkg = (cat $OMF_CONFIG/theme)
echo default > $OMF_CONFIG/theme
end
omf.bundle.remove "theme" $pkg
omf.bundle.remove "theme" $pkg
rm -rf $path
set remove_status $status
end
rm -rf $path
set remove_status $status
end
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
if test $remove_status -eq 0
echo (omf::em)"$pkg successfully removed."(omf::off)
else
echo (omf::err)"$pkg could not be found"(omf::off) 1^&2
end
return $remove_status
end

@ -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

Loading…
Cancel
Save