Commit a6d46893a848439ba003d418a8e9dfadaba669cc
1 parent
49dc1fb413
add a selfupdate function to update antigen itself
Showing 1 changed file with 25 additions and 10 deletions Side-by-side Diff
antigen.zsh
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | # <repo-url>, <plugin-location>, <bundle-type>, <has-local-clone> |
6 | 6 | # FIXME: Is not kept local by zsh! |
7 | 7 | local _ANTIGEN_BUNDLE_RECORD="" |
8 | +local _ANTIGEN_INSTALL_DIR="$(dirname $0)" | |
8 | 9 | |
9 | 10 | # Syntaxes |
10 | 11 | # antigen-bundle <url> [<loc>=/] |
... | ... | @@ -293,6 +294,19 @@ antigen-revert () { |
293 | 294 | |
294 | 295 | } |
295 | 296 | |
297 | +antigen-selfupdate () { | |
298 | + # Initiate subshell | |
299 | + ( | |
300 | + cd $_ANTIGEN_INSTALL_DIR | |
301 | + # Sanity checks | |
302 | + if [ ! -d .git ]; then | |
303 | + echo "antigen is not under git CVS" | |
304 | + return 1 | |
305 | + fi | |
306 | + git pull | |
307 | + ) | |
308 | +} | |
309 | + | |
296 | 310 | antigen-cleanup () { |
297 | 311 | |
298 | 312 | # Cleanup unused repositories. |
... | ... | @@ -643,16 +657,17 @@ antigen () { |
643 | 657 | |
644 | 658 | # Setup antigen's autocompletion |
645 | 659 | _antigen () { |
646 | - compadd \ | |
647 | - bundle\ | |
648 | - bundles\ | |
649 | - update\ | |
650 | - revert\ | |
651 | - list\ | |
652 | - cleanup\ | |
653 | - lib\ | |
654 | - theme\ | |
655 | - apply\ | |
660 | + compadd \ | |
661 | + bundle \ | |
662 | + bundles \ | |
663 | + update \ | |
664 | + revert \ | |
665 | + list \ | |
666 | + cleanup \ | |
667 | + lib \ | |
668 | + selfupdate \ | |
669 | + theme \ | |
670 | + apply \ | |
656 | 671 | help |
657 | 672 | } |
658 | 673 |