oh-my-fish/plugins/omf/omf.packages.update.fish

54 lines
1.7 KiB
Fish
Raw Normal View History

2015-05-26 21:48:21 +08:00
# NAME
2015-05-31 19:31:55 +08:00
# omf.packages.update - Update all plugins and themes
2015-05-26 21:48:21 +08:00
#
# DESCRIPTION
# Update all plugins and themes specified on the $fish_plugins
# and $fish_theme variables
#
2015-05-31 19:31:55 +08:00
function omf.packages.update -d "Update all plugins and themes"
2015-05-26 21:48:21 +08:00
set -l installed_packages 0
pushd
# Plugins
for plugin in $fish_plugins
if [ -e $fish_path/plugins/$plugin -a -e $fish_path/plugins/$plugin/.git ]
2015-05-31 19:31:55 +08:00
omf.log -n white "Updating $plugin... "
2015-05-26 21:48:21 +08:00
echo (cd $fish_path/plugins/$plugin; and git pull --rebase > /dev/null) >/dev/null
2015-05-31 19:31:55 +08:00
omf.log green "√"
2015-05-26 21:48:21 +08:00
set -l installed_packages 1
else
if [ -e $fish_custom/plugins/$plugin -a -e $fish_custom/plugins/$plugin/.git ]
2015-05-31 19:31:55 +08:00
omf.log -n white "Updating $plugin... "
2015-05-26 21:48:21 +08:00
echo (cd $fish_custom/plugins/$plugin; and git pull --rebase > /dev/null) >/dev/null
2015-05-31 19:31:55 +08:00
omf.log green "√"
2015-05-26 21:48:21 +08:00
set -l installed_packages 1
else
#echo "$plugin is not installed or not a git repo. Skipping."
end
end
end
# Theme
if [ -e $fish_path/themes/$fish_theme -a -e $fish_path/themes/$fish_theme/.git ]
2015-05-31 19:31:55 +08:00
omf.log -n white "Updating $fish_theme... "
2015-05-26 21:48:21 +08:00
echo (cd $fish_path/themes/$fish_theme; and git pull --rebase > /dev/null) >/dev/null
2015-05-31 19:31:55 +08:00
omf.log green "√"
2015-05-26 21:48:21 +08:00
set -l installed_packages 1
else
if [ -e $fish_custom/themes/$fish_theme -a -e $fish_custom/themes/$fish_theme/.git ]
2015-05-31 19:31:55 +08:00
omf.log -n white "Updating $fish_theme... "
2015-05-26 21:48:21 +08:00
echo (cd $fish_custom/themes/$fish_theme; and git pull --rebase > /dev/null) >/dev/null
2015-05-31 19:31:55 +08:00
omf.log green "√"
2015-05-26 21:48:21 +08:00
set -l installed_packages 1
else
#echo "$fish_theme is not installed or not a git repo. Skipping."
end
end
if [ $installed_packages -eq 0 ]
2015-05-31 19:31:55 +08:00
omf.log green 'No plugins to update.'
2015-05-26 21:48:21 +08:00
end
popd
end