b621eee21f269498d072ca60823ecde9777821bb

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

Message

fix(cli): fix zsh array syntax for szh 5.0.2

Diff

 1diff --git a/lib/cli.zsh b/lib/cli.zsh
 2index 773891fce749074e0c92b704cdcbfbe61bcf3ef6..4b14360c1e17450375bb9d92e0872614daaac5e0 100644
 3--- a/lib/cli.zsh
 4+++ b/lib/cli.zsh
 5@@ -91,7 +91,8 @@ function _omz {
 6         # NOTE: $(( CURRENT - 1 )) is the last plugin argument completely passed, i.e. that which
 7         # has a space after them. This is to avoid removing plugins partially passed, which makes
 8         # the completion not add a space after the completed plugin.
 9-        local -a args=(${words[4,$(( CURRENT - 1))]})
10+        local -a args
11+        args=(${words[4,$(( CURRENT - 1))]})
12         valid_plugins=(${valid_plugins:|args})
13 
14         _describe 'plugin' valid_plugins ;;
15@@ -214,7 +215,7 @@ function _omz::plugin::disable {
16   fi
17 
18   # Check that plugin is in $plugins
19-  local -a dis_plugins=()
20+  local -a dis_plugins
21   for plugin in "$@"; do
22     if [[ ${plugins[(Ie)$plugin]} -eq 0 ]]; then
23       _omz::log warn "plugin '$plugin' is not enabled."
24@@ -303,7 +304,7 @@ function _omz::plugin::enable {
25   fi
26 
27   # Check that plugin is not in $plugins
28-  local -a add_plugins=()
29+  local -a add_plugins
30   for plugin in "$@"; do
31     if [[ ${plugins[(Ie)$plugin]} -ne 0 ]]; then
32       _omz::log warn "plugin '$plugin' is already enabled."
33@@ -424,10 +425,8 @@ function _omz::plugin::load {
34     return 1
35   fi
36 
37-  local plugins=("$@")
38   local plugin base has_completion=0
39-
40-  for plugin in $plugins; do
41+  for plugin in "$@"; do
42     if [[ -d "$ZSH_CUSTOM/plugins/$plugin" ]]; then
43       base="$ZSH_CUSTOM/plugins/$plugin"
44     elif [[ -d "$ZSH/plugins/$plugin" ]]; then