aboutsummaryrefslogtreecommitdiffstats
path: root/src/_yarn
diff options
context:
space:
mode:
authorShohei YOSHIDA <syohex@gmail.com>2020-05-09 16:48:48 +0900
committerShohei YOSHIDA <syohex@gmail.com>2020-05-09 16:48:48 +0900
commitfd64c85cf70ba79e607630c92dbd0eb4bbcff2a1 (patch)
tree83c06a7c8d6c73b37ce5815368a5070c5c7cc7bb /src/_yarn
parentMerge pull request #713 from syohex/syohex/update-yarn (diff)
downloadzsh-completions-fd64c85cf70ba79e607630c92dbd0eb4bbcff2a1.tar
zsh-completions-fd64c85cf70ba79e607630c92dbd0eb4bbcff2a1.tar.gz
zsh-completions-fd64c85cf70ba79e607630c92dbd0eb4bbcff2a1.tar.bz2
zsh-completions-fd64c85cf70ba79e607630c92dbd0eb4bbcff2a1.tar.lz
zsh-completions-fd64c85cf70ba79e607630c92dbd0eb4bbcff2a1.tar.xz
zsh-completions-fd64c85cf70ba79e607630c92dbd0eb4bbcff2a1.tar.zst
zsh-completions-fd64c85cf70ba79e607630c92dbd0eb4bbcff2a1.zip
Fix run subcommand --cwd issue
opt_args cannot be read from 2nd completion
Diffstat (limited to 'src/_yarn')
-rw-r--r--src/_yarn11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/_yarn b/src/_yarn
index f9e40dc..0d967f2 100644
--- a/src/_yarn
+++ b/src/_yarn
@@ -36,6 +36,8 @@
#
# ------------------------------------------------------------------------------
+declare -g _yarn_run_cwd
+
_commands=(
'access'
'audit:Checks for known security issues with the installed packages'
@@ -99,8 +101,8 @@ _yarn_scripts() {
local -a scriptNames scriptCommands
local i runJSON
- if [[ -n $opt_args[--cwd] ]]; then
- runJSON=$(cd $opt_args[--cwd] && yarn run --json 2>/dev/null)
+ if [[ -n $_yarn_run_cwd ]]; then
+ runJSON=$(cd $_yarn_run_cwd && yarn run --json 2>/dev/null)
else
runJSON=$(yarn run --json 2>/dev/null)
fi
@@ -313,6 +315,11 @@ _yarn() {
;;
run)
+ if [[ -n $opt_args[--cwd] ]]; then
+ _yarn_run_cwd=$opt_args[--cwd]
+ else
+ _yarn_run_cwd=''
+ fi
_arguments \
'1: :_yarn_scripts' \
'*:: :_default'