Permalink
Browse files

add check for pmodload, fallback to sourcing if it is not defined

  • Loading branch information...
1 parent 77c0b3a commit b84ae117e28c8464f652fcbd97432b587f4aca33 Gregory Hugaerts committed Feb 21, 2013
Showing with 9 additions and 3 deletions.
  1. +9 −3 antigen.zsh
View
12 antigen.zsh
@@ -273,9 +273,15 @@ antigen-revert () {
source "$location/$script_loc"
elif [[ -f $location/init.zsh ]]; then
- # If we have a `init.zsh`, pmodload the module.
- local module="$(echo $loc|sed -e 's/^modules\///')" #remove modules/ from loc to find module name
- pmodload "$module"
+ # If we have a `init.zsh`
+ if (( $+functions[pmodload] )); then
+ # if pmodload is defined pmodload the module.
+ local module="$(echo $loc|sed -e 's/^modules\///')" #remove modules/ from loc to find module name
+ pmodload "$module"
+ else
+ # otherwise source it.
+ source "$location/init.zsh"
+ fi
elif ls "$location" | grep -qm1 '\.zsh$'; then
# If there is no `*.plugin.zsh` file, source *all* the `*.zsh`

0 comments on commit b84ae11

Please sign in to comment.