Create omf.update function

Update and install were one thing before.
This commit is contained in:
Bruno Pinto 2015-10-12 22:07:44 +01:00 committed by Pablo Santiago Blum de Aguiar
parent c346731743
commit cc7b321268
2 changed files with 30 additions and 3 deletions

View File

@ -0,0 +1,25 @@
function omf.update -a name
function __omf.update.success
echo (omf::em)"$argv successfully updated."(omf::off)
end
function __omf.update.error
echo (omf::err)"Could not update $argv."(omf::off) 1^&2
end
if test \( -e $OMF_PATH/themes/$name \) -o \( -e $OMF_CONFIG/themes/$name \)
set install_type "theme"
set parent_path "themes"
else
set install_type "package"
set parent_path "pkg"
end
for path in {$OMF_PATH,$OMF_CONFIG}/pkg/$name
not test -e "$path/.git"; and continue
omf.repo.pull $path; and set return_success
end
set -q return_success; and __omf.update.success "$name"
end

View File

@ -139,10 +139,12 @@ function omf -d "Oh My Fish"
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
omf.theme (cat $OMF_CONFIG/theme)
omf.install_package (omf.packages.list --installed --plugin)
refresh
for package in (omf.packages.list --installed)
omf.update $package
end
refresh
case "*"
echo (omf::err)"$argv[1] option not recognized"(omf::off) 1^&2
return $OMF_UNKNOWN_OPT