Skip to content

Commit

Permalink
style(bundler): simplify bundled_commands array operations
Browse files Browse the repository at this point in the history
  • Loading branch information
mcornella committed Nov 17, 2021
1 parent 98b4801 commit 15fd9c8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions plugins/bundler/bundler.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,12 @@ bundled_commands=(
)

# Remove $UNBUNDLED_COMMANDS from the bundled_commands list
for cmd in $UNBUNDLED_COMMANDS; do
bundled_commands=(${bundled_commands#$cmd});
done
bundled_commands=(${bundled_commands:|UNBUNDLED_COMMANDS})
unset UNBUNDLED_COMMANDS

# Add $BUNDLED_COMMANDS to the bundled_commands list
for cmd in $BUNDLED_COMMANDS; do
bundled_commands+=($cmd);
done
bundled_commands+=($BUNDLED_COMMANDS)
unset BUNDLED_COMMANDS

# Check if in the root or a subdirectory of a bundled project
_within-bundled-project() {
Expand Down Expand Up @@ -126,5 +124,4 @@ for cmd in $bundled_commands; do
compdef "_$cmd" "bundled_$cmd"="$cmd"
fi
done

unset cmd bundled_commands

0 comments on commit 15fd9c8

Please sign in to comment.