2015-12-20 17:57:51 -02:00
|
|
|
function omf.cli.update
|
2016-03-11 18:59:06 +02:00
|
|
|
set -l update_core
|
|
|
|
set -l packages $argv
|
|
|
|
if test (count $packages) -gt 0
|
|
|
|
# If several packages are listed, only update core if "omf" is listed among them.
|
|
|
|
# Also keep "omf" out of the list of packages to update.
|
|
|
|
set index (contains -i -- omf $packages)
|
|
|
|
and set -e packages[$index]
|
|
|
|
or set -e update_core
|
2015-12-20 17:57:51 -02:00
|
|
|
else
|
2017-02-04 21:49:39 -06:00
|
|
|
set packages (omf.packages.list)
|
2015-12-20 17:57:51 -02:00
|
|
|
end
|
|
|
|
|
2016-03-11 18:59:06 +02:00
|
|
|
if set -q update_core
|
2016-03-28 09:13:55 +03:00
|
|
|
omf.core.update
|
2016-10-20 18:10:13 -05:00
|
|
|
|
|
|
|
if type -q omf.version
|
|
|
|
set OMF_VERSION (omf.version)
|
|
|
|
end
|
|
|
|
|
2016-03-28 09:13:55 +03:00
|
|
|
if test $status -ne 1
|
2016-03-11 18:59:06 +02:00
|
|
|
echo (omf::em)"Oh My Fish is up to date."(omf::off)
|
2016-10-20 18:10:13 -05:00
|
|
|
echo (omf::em)"You are now using Oh My Fish version $OMF_VERSION."(omf::off)
|
2016-03-11 18:59:06 +02:00
|
|
|
else
|
|
|
|
echo (omf::err)"Oh My Fish failed to update."(omf::off)
|
|
|
|
echo "Please open a new issue here → "(omf::em)"github.com/oh-my-fish/oh-my-fish/issues"(omf::off)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-02-04 21:49:39 -06:00
|
|
|
omf.index.update
|
|
|
|
or return 1
|
|
|
|
|
2016-03-11 18:59:06 +02:00
|
|
|
for package in $packages
|
2015-12-20 17:57:51 -02:00
|
|
|
omf.packages.update $package
|
|
|
|
end
|
2016-02-23 22:59:10 -03:00
|
|
|
|
|
|
|
# Opt-in flag for testing
|
2016-07-18 18:25:02 -05:00
|
|
|
if set -q OMF_AUTO_RELOAD
|
|
|
|
omf.cli.reload
|
|
|
|
end
|
2015-12-20 17:57:51 -02:00
|
|
|
end
|