2015-08-27 19:55:29 +01:00
|
|
|
function omf.remove_package
|
2015-08-29 19:24:51 -03:00
|
|
|
|
2015-09-12 23:50:22 +02:00
|
|
|
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
|
2015-08-27 00:20:13 +09:00
|
|
|
end
|
2015-09-12 23:50:22 +02:00
|
|
|
return $OMF_INVALID_ARG
|
|
|
|
end
|
2015-08-27 00:20:13 +09:00
|
|
|
|
2015-09-12 23:50:22 +02:00
|
|
|
for path in {$OMF_PATH,$OMF_CONFIG}/{pkg}/$pkg
|
|
|
|
not test -d $path; and continue
|
2015-08-29 19:10:47 +01:00
|
|
|
|
2015-10-04 13:49:58 +01:00
|
|
|
source $path/uninstall.fish ^/dev/null; and emit uninstall_$pkg
|
2015-09-12 23:50:22 +02:00
|
|
|
omf.bundle.remove "package" $pkg
|
2015-08-29 19:24:51 -03:00
|
|
|
|
2015-09-12 23:50:22 +02:00
|
|
|
rm -rf $path
|
|
|
|
set remove_status $status
|
|
|
|
end
|
2015-08-29 19:10:47 +01:00
|
|
|
|
2015-09-12 23:50:22 +02:00
|
|
|
for path in {$OMF_PATH,$OMF_CONFIG}/{themes}/$pkg
|
|
|
|
not test -d $path; and continue
|
2015-08-29 19:10:47 +01:00
|
|
|
|
2015-09-12 23:50:22 +02:00
|
|
|
if test $pkg = (cat $OMF_CONFIG/theme)
|
|
|
|
echo default > $OMF_CONFIG/theme
|
|
|
|
end
|
2015-08-29 19:10:47 +01:00
|
|
|
|
2015-09-12 23:50:22 +02:00
|
|
|
omf.bundle.remove "theme" $pkg
|
2015-08-29 19:24:51 -03:00
|
|
|
|
2015-09-12 23:50:22 +02:00
|
|
|
rm -rf $path
|
|
|
|
set remove_status $status
|
|
|
|
end
|
2015-08-29 19:10:47 +01:00
|
|
|
|
2015-09-12 23:50:22 +02:00
|
|
|
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
|
2015-08-27 00:20:13 +09:00
|
|
|
end
|
2015-09-12 23:50:22 +02:00
|
|
|
return $remove_status
|
2015-08-27 03:15:05 +09:00
|
|
|
end
|