From ba54f170a6250080ca88089ac6bf8cfbfe3c2b43 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 17 Aug 2023 12:13:27 +0900 Subject: [PATCH] Avoid defining local variable options zsh has the built in variable 'options'. zsh sometimes behaves weirdly when there is a local variable that is named 'options' --- src/_pkcon | 12 ++++++------ src/_virtualbox | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/_pkcon b/src/_pkcon index 3bf8057..e8a7ba9 100644 --- a/src/_pkcon +++ b/src/_pkcon @@ -36,8 +36,8 @@ # ------------------------------------------------------------------------------ -local -a options -options=( +local -a command_options +command_options=( '--version[Show the program version and exit]' '--filter[Set the filter, e.g. installed]' "--root[Set the install root, e.g. '/' or '/mnt/ltsp']" @@ -107,23 +107,23 @@ done if [[ -z "$cmd" ]] then - _arguments -s -w : $options \ + _arguments -s -w : $command_options \ ":action:($actions)" return fi case "$cmd" in search) - _arguments : $options \ + _arguments : $command_options \ ':type:(name details group file)' \ ':data: :' ;; refresh) - _arguments -s -w : $options \ + _arguments -s -w : $command_options \ '--force' ;; *) - _arguments -s -w : $options + _arguments -s -w : $command_options ;; esac return 1 diff --git a/src/_virtualbox b/src/_virtualbox index f7e7b97..655b159 100644 --- a/src/_virtualbox +++ b/src/_virtualbox @@ -339,9 +339,9 @@ _vboxmanage() { && ret=0 ;; (modifyvm|export) - local -a options=(${(@f)"$(vboxmanage $words[1] | perl -wln -e 'm{(--[a-zA-Z_-]+) [^]|]+} and print qq{$1:arg}')"}) + local -a command_options=(${(@f)"$(vboxmanage $words[1] | perl -wln -e 'm{(--[a-zA-Z_-]+) [^]|]+} and print qq{$1:arg}')"}) _arguments \ - $options \ + $command_options \ ':machine:_vboxmachines' ;; (controlvm)