Skip to content

Commit b009020

Browse files
authored
Merge pull request #753 from Luthaf/zsh-complete
Fix local declarations for zsh completions
2 parents fc5580b + e4e6327 commit b009020

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/rustup-cli/zsh/_rustup

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ case $state in
1515
args)
1616
case $words[1] in
1717
component)
18-
local -a subcommands=(
18+
local -a subcommands
19+
subcommands=(
1920
'list:list installed and available components'
2021
'add:add a component to a toolchain'
2122
'remove:remove a component from a toolchain'
@@ -52,7 +53,8 @@ case $state in
5253
;;
5354

5455
override)
55-
local -a subcommands=(
56+
local -a subcommands
57+
subcommands=(
5658
'list:list directory toolchain overrides'
5759
'set:set the override toolchain for a directory'
5860
'unset:remove the override toolchain for a directory'
@@ -72,7 +74,8 @@ case $state in
7274

7375

7476
self)
75-
local -a subcommands=(
77+
local -a subcommands
78+
subcommands=(
7679
'update:download and install updates to rustup'
7780
'uninstall:uninstall rustup'
7881
'upgrade-data:upgrade the internal data format'
@@ -84,7 +87,8 @@ case $state in
8487
;;
8588

8689
set)
87-
local -a subcommands=(
90+
local -a subcommands
91+
subcommands=(
8892
'default-host:The triple used to identify toolchains' \
8993
'help:prints this message or the help of the given subcommand(s)'
9094
)
@@ -98,7 +102,8 @@ case $state in
98102
;;
99103

100104
target)
101-
local -a subcommands=(
105+
local -a subcommands
106+
subcommands=(
102107
'list:list installed and available targets'
103108
'add:add a target to a toolchain'
104109
'remove:remove a target from a toolchain'
@@ -110,7 +115,8 @@ case $state in
110115
;;
111116

112117
toolchain)
113-
local -a subcommands=(
118+
local -a subcommands
119+
subcommands=(
114120
'list:list installed toolchains'
115121
'install:install or update a toolchain'
116122
'uninstall:uninstall a toolchain'
@@ -139,7 +145,8 @@ esac
139145
}
140146

141147
_get_local_toolchains() {
142-
local -a toolchains=()
148+
local -a toolchains
149+
toolchains=()
143150
rustup toolchain list 2>/dev/null | while read line
144151
do
145152
toolchains+="${line%%-*}"
@@ -148,7 +155,9 @@ _get_local_toolchains() {
148155
}
149156

150157
_rustup_cmds(){
151-
local -a commands=(
158+
local -a commands
159+
160+
commands=(
152161
'show:show the active and installed toolchains'
153162
'update:update Rust toolchains'
154163
'default:set the default toolchain'

0 commit comments

Comments
 (0)