1zmodload zsh/parameter 2autoload -U is-at-least 3 4# While boot.zsh is part of the ext/cache functionallity it may be disabled 5# with ANTIGEN_CACHE flag, and it's always compiled with antigen.zsh 6if [[ $ANTIGEN_CACHE != false ]]; then 7 ANTIGEN_CACHE="${ANTIGEN_CACHE:-${ADOTDIR:-$HOME/.antigen}/init.zsh}" 8 ANTIGEN_RSRC="${ANTIGEN_RSRC:-${ADOTDIR:-$HOME/.antigen}/.resources}" 9 10 # It may not be necessary to check ANTIGEN_AUTO_CONFIG. 11 if [[ $ANTIGEN_AUTO_CONFIG != false && -f $ANTIGEN_RSRC ]]; then 12 # Check the list of files for configuration changes (uses -nt comp) 13 ANTIGEN_CHECK_FILES=$(cat $ANTIGEN_RSRC 2> /dev/null) 14 ANTIGEN_CHECK_FILES=(${(@f)ANTIGEN_CHECK_FILES}) 15 16 for config in $ANTIGEN_CHECK_FILES; do 17 if [[ "$config" -nt "$config.zwc" ]]; then 18 # Flag configuration file as newer 19 { zcompile "$config" } &! 20 # Kill cache file in order to force full loading (see a few lines below) 21 [[ -f "$ANTIGEN_CACHE" ]] && rm -f "$ANTIGEN_CACHE" 22 fi 23 done 24 fi 25 26 # If there is a cache file do load from it 27 if [[ -f $ANTIGEN_CACHE && ! $_ANTIGEN_CACHE_LOADED == true ]]; then 28 # Wrap antigen in order to defer cache source until `antigen-apply` 29 antigen() { 30 if [[ $1 == "apply" ]]; then 31 source "$ANTIGEN_CACHE" 32 # Handle `antigen-init` command properly 33 elif [[ $1 == "init" ]]; then 34 source "$2" 35 fi 36 } 37 # Do not continue loading antigen as cache bundle takes care of it. 38 return 0 39 fi 40fi 41