2015-12-21 03:57:51 +08:00
|
|
|
function omf.cli.remove -a name
|
|
|
|
switch (count $argv)
|
|
|
|
case 1
|
|
|
|
omf.packages.remove $name
|
|
|
|
set code $status
|
|
|
|
|
|
|
|
switch $code
|
|
|
|
case 0
|
|
|
|
echo (omf::em)"$name successfully removed."(omf::off)
|
2016-02-24 09:59:10 +08:00
|
|
|
# Opt-in flag for testing
|
|
|
|
set -q OMF_AUTO_RELOAD
|
|
|
|
and omf.cli.reload
|
2015-12-21 03:57:51 +08:00
|
|
|
case 1
|
2016-12-18 10:26:46 +08:00
|
|
|
echo (omf::err)"$name could not be removed."(omf::off) >&2
|
2015-12-21 03:57:51 +08:00
|
|
|
case 2
|
2016-12-18 10:26:46 +08:00
|
|
|
echo (omf::err)"$name could not be found."(omf::off) >&2
|
2015-12-21 03:57:51 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
return $code
|
|
|
|
|
|
|
|
case '*'
|
2016-12-18 10:26:46 +08:00
|
|
|
echo (omf::err)"Invalid number of arguments"(omf::off) >&2
|
|
|
|
echo "Usage: omf remove "(omf::em)"<name>"(omf::off) >&2
|
2015-12-21 03:57:51 +08:00
|
|
|
return $OMF_INVALID_ARG
|
|
|
|
end
|
|
|
|
end
|