15fd9c84deae400ba52451d75548fb8f6ec26bcf

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

style(bundler): simplify `bundled_commands` array operations

Diff

 1diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
 2index c93d4869ea0a61722d8692d51962d8eb01bf9a9a..c1cbb13ddeda375415015ba8c2012908fb27eb31 100644
 3--- a/plugins/bundler/bundler.plugin.zsh
 4+++ b/plugins/bundler/bundler.plugin.zsh
 5@@ -81,14 +81,12 @@ bundled_commands=(
 6 )
 7 
 8 # Remove $UNBUNDLED_COMMANDS from the bundled_commands list
 9-for cmd in $UNBUNDLED_COMMANDS; do
10-  bundled_commands=(${bundled_commands#$cmd});
11-done
12+bundled_commands=(${bundled_commands:|UNBUNDLED_COMMANDS})
13+unset UNBUNDLED_COMMANDS
14 
15 # Add $BUNDLED_COMMANDS to the bundled_commands list
16-for cmd in $BUNDLED_COMMANDS; do
17-  bundled_commands+=($cmd);
18-done
19+bundled_commands+=($BUNDLED_COMMANDS)
20+unset BUNDLED_COMMANDS
21 
22 # Check if in the root or a subdirectory of a bundled project
23 _within-bundled-project() {
24@@ -126,5 +124,4 @@ for cmd in $bundled_commands; do
25     compdef "_$cmd" "bundled_$cmd"="$cmd"
26   fi
27 done
28-
29 unset cmd bundled_commands