]> arthur.barton.de Git - ax-zsh.git/commitdiff
ax.zsh: Don't clobber global namespace with function variables
authorAlexander Barton <alex@barton.de>
Fri, 7 Apr 2017 19:29:53 +0000 (21:29 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 7 Apr 2017 19:29:53 +0000 (21:29 +0200)
ax.zsh

diff --git a/ax.zsh b/ax.zsh
index e0812a7719f40baafa3b2536125c0544b4bf2dbd..556061a36f096b436c7df7196462467c7192145f 100644 (file)
--- a/ax.zsh
+++ b/ax.zsh
@@ -9,11 +9,11 @@ script_type="$script_name[2,-1]"
 # - $2: plugin type (optional; defaults to "zshrc")
 # - $3: cache file (optional)
 function axzsh_load_plugin {
-       dname="$1:A"
-       plugin="$dname:t"
-       [[ -z "$2" ]] && type="zshrc" || type="$2"
-       fname="$dname/$plugin.$type"
-       cache_file="$3"
+       local dname="$1:A"
+       local plugin="$dname:t"
+       [[ -z "$2" ]] && local type="zshrc" || local type="$2"
+       local fname="$dname/$plugin.$type"
+       local cache_file="$3"
 
        # Strip repository prefix (like "alexbarton#test-plugin"):
        [[ "$plugin" =~ "#" ]] && plugin=$(echo $plugin | cut -d'#' -f2-)