prezto/functions/update-omz

33 lines
1 KiB
Text
Raw Normal View History

2012-01-27 04:34:00 -05:00
# Update OMZ
# Jonathan Dahan <jonathan@jedahan.com>
2012-01-27 04:53:09 -05:00
# There are two options that can be added to your zshrc
#
2012-01-27 04:53:09 -05:00
# If upstream is a branch other than origin, add
#
2012-01-27 04:53:09 -05:00
# zstyle ':omz:function:update-omz' upstream 'my-upstream-branch'
#
# To automatically commit from upstream, add
#
# zstyle ':omz:function:update-omz' auto-commit 'yes'
#
# If you really need auto-updating and do not care about losing data, try
#
# ( [ ! -f ~/.omz-update ] || [ ~/.omz-update(Nmh+6) ] ) && update-omz && touch ~/.omz-update
current_path=$PWD
2012-01-27 04:37:45 -05:00
cd $OMZ_HOME
zstyle -t ':omz:function:update-omz' auto-commit || local nocommit='--no-commit'
2012-01-27 04:37:04 -05:00
zstyle -t ':omz:function:update-omz' upstream '_upstream'
2012-01-27 04:37:04 -05:00
if git pull $nocommit --strategy=recursive -X ours ${_upstream:-origin} master; then
zstyle -t ':omz:function:update-omz' color && printf "$FG[blue]"
printf 'Hooray! oh-my-zsh is up-to-date :)'
else
zstyle -t ':omz:function:update-omz' color && printf "$FG[red]"
printf 'Oh no! There was an error updating oh-my-zsh :('
fi
cd "$current_path"