From a6d46893a848439ba003d418a8e9dfadaba669cc Mon Sep 17 00:00:00 2001 From: Xavier Garrido Date: Sat, 16 Feb 2013 09:27:02 +0100 Subject: [PATCH] add a selfupdate function to update antigen itself --- antigen.zsh | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/antigen.zsh b/antigen.zsh index 3803f09..5d38d87 100644 --- a/antigen.zsh +++ b/antigen.zsh @@ -5,6 +5,7 @@ # , , , # FIXME: Is not kept local by zsh! local _ANTIGEN_BUNDLE_RECORD="" +local _ANTIGEN_INSTALL_DIR="$(dirname $0)" # Syntaxes # antigen-bundle [=/] @@ -293,6 +294,19 @@ antigen-revert () { } +antigen-selfupdate () { + # Initiate subshell + ( + cd $_ANTIGEN_INSTALL_DIR + # Sanity checks + if [ ! -d .git ]; then + echo "antigen is not under git CVS" + return 1 + fi + git pull + ) +} + antigen-cleanup () { # Cleanup unused repositories. @@ -643,16 +657,17 @@ antigen () { # Setup antigen's autocompletion _antigen () { - compadd \ - bundle\ - bundles\ - update\ - revert\ - list\ - cleanup\ - lib\ - theme\ - apply\ + compadd \ + bundle \ + bundles \ + update \ + revert \ + list \ + cleanup \ + lib \ + selfupdate \ + theme \ + apply \ help } -- 2.0.0