Commit b84ae117e28c8464f652fcbd97432b587f4aca33
1 parent
77c0b3a724
add check for pmodload, fallback to sourcing if it is not defined
Showing 1 changed file with 9 additions and 3 deletions Side-by-side Diff
antigen.zsh
... | ... | @@ -273,9 +273,15 @@ antigen-revert () { |
273 | 273 | source "$location/$script_loc" |
274 | 274 | |
275 | 275 | elif [[ -f $location/init.zsh ]]; then |
276 | - # If we have a `init.zsh`, pmodload the module. | |
277 | - local module="$(echo $loc|sed -e 's/^modules\///')" #remove modules/ from loc to find module name | |
278 | - pmodload "$module" | |
276 | + # If we have a `init.zsh` | |
277 | + if (( $+functions[pmodload] )); then | |
278 | + # if pmodload is defined pmodload the module. | |
279 | + local module="$(echo $loc|sed -e 's/^modules\///')" #remove modules/ from loc to find module name | |
280 | + pmodload "$module" | |
281 | + else | |
282 | + # otherwise source it. | |
283 | + source "$location/init.zsh" | |
284 | + fi | |
279 | 285 | |
280 | 286 | elif ls "$location" | grep -qm1 '\.zsh$'; then |
281 | 287 | # If there is no `*.plugin.zsh` file, source *all* the `*.zsh` |