2015-05-26 13:48:21 +00:00
|
|
|
# NAME
|
2015-05-31 12:29:05 +00:00
|
|
|
# omf.packages.update - Update a plugin or theme
|
|
|
|
#
|
|
|
|
# SYNOPSIS
|
|
|
|
# --plugin <plugin_name>
|
|
|
|
# --theme <theme_name>
|
2015-05-26 13:48:21 +00:00
|
|
|
#
|
|
|
|
# DESCRIPTION
|
2015-05-31 12:29:05 +00:00
|
|
|
# Update a plugin or theme
|
2015-05-26 13:48:21 +00:00
|
|
|
#
|
2015-05-31 12:29:05 +00:00
|
|
|
function omf.packages.update --argument-names type name -d "Update a plugin or theme"
|
|
|
|
pushd # Save current dir
|
2015-05-26 13:48:21 +00:00
|
|
|
|
2015-05-31 12:29:05 +00:00
|
|
|
switch $type
|
|
|
|
case '--plugin'
|
|
|
|
if [ -e $fish_path/plugins/$name -a -e $fish_path/plugins/$name/.git ]
|
2015-05-31 13:09:20 +00:00
|
|
|
emit omf_package_updating $name
|
2015-05-31 12:29:05 +00:00
|
|
|
echo (cd $fish_path/plugins/$name; and git pull --rebase > /dev/null) >/dev/null
|
2015-05-31 13:09:20 +00:00
|
|
|
emit omf_package_updated $name
|
2015-05-26 13:48:21 +00:00
|
|
|
else
|
2015-05-31 12:29:05 +00:00
|
|
|
if [ -e $fish_custom/plugins/$name -a -e $fish_custom/plugins/$name/.git ]
|
2015-05-31 13:09:20 +00:00
|
|
|
emit omf_package_updating $name
|
2015-05-31 12:29:05 +00:00
|
|
|
echo (cd $fish_custom/plugins/$name; and git pull --rebase > /dev/null) >/dev/null
|
2015-05-31 13:09:20 +00:00
|
|
|
emit omf_package_updated $name
|
2015-05-31 12:29:05 +00:00
|
|
|
else
|
2015-05-31 13:09:20 +00:00
|
|
|
# Plugin is not installed or not a git repo. Skipping.
|
2015-05-31 12:29:05 +00:00
|
|
|
end
|
2015-05-26 13:48:21 +00:00
|
|
|
end
|
2015-05-31 12:29:05 +00:00
|
|
|
case '--theme'
|
|
|
|
if [ -e $fish_path/themes/$name -a -e $fish_path/themes/$name/.git ]
|
2015-05-31 13:09:20 +00:00
|
|
|
emit omf_package_updating $name
|
2015-05-31 12:29:05 +00:00
|
|
|
echo (cd $fish_path/themes/$name; and git pull --rebase > /dev/null) >/dev/null
|
2015-05-31 13:09:20 +00:00
|
|
|
emit omf_package_updated $name
|
2015-05-31 12:29:05 +00:00
|
|
|
else
|
|
|
|
if [ -e $fish_custom/themes/$name -a -e $fish_custom/themes/$name/.git ]
|
2015-05-31 13:09:20 +00:00
|
|
|
emit omf_package_updating $name
|
2015-05-31 12:29:05 +00:00
|
|
|
echo (cd $fish_custom/themes/$name; and git pull --rebase > /dev/null) >/dev/null
|
2015-05-31 13:09:20 +00:00
|
|
|
emit omf_package_updated $name
|
2015-05-31 12:29:05 +00:00
|
|
|
else
|
2015-05-31 13:09:20 +00:00
|
|
|
# Theme is not installed or not a git repo. Skipping.
|
2015-05-31 12:29:05 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
case '*'
|
|
|
|
omf.log red 'Unknown option'
|
2015-05-26 13:48:21 +00:00
|
|
|
end
|
|
|
|
|
2015-05-31 12:29:05 +00:00
|
|
|
popd # Restore current dir
|
2015-05-26 13:48:21 +00:00
|
|
|
end
|