From 1b1b0c7c8fb34926733e2292acd11cfef2b58ae7 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 6 Jan 2022 19:47:55 +0900 Subject: [PATCH] Fix script completion which contains colons --- src/_yarn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_yarn b/src/_yarn index 1cce1b1..1237ba6 100644 --- a/src/_yarn +++ b/src/_yarn @@ -116,7 +116,7 @@ _yarn_commands_scripts() { fi if [[ -n $packageJson ]]; then - scripts=($(cat "$packageJson" | perl -0777 -MJSON::PP -n -E '$r=decode_json($_); say for sort keys %{$r->{scripts}}')) + scripts=($(cat "$packageJson" | perl -0777 -MJSON::PP -n -E '$r=decode_json($_); do{($k=$_)=~s/:/\\:/g;say $k}for sort keys %{$r->{scripts}}')) fi _describe 'command or script' _commands -- _global_commands -- scripts -- binaries @@ -144,7 +144,7 @@ _yarn_scripts() { fi if [[ -n $packageJson ]]; then - scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E '%r=%{decode_json($_)->{scripts}}; printf "$_:$r{$_}\n" for sort keys %r')}") + scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E '%r=%{decode_json($_)->{scripts}}; do{$k=$_;($e=$k)=~s/:/\\:/g; printf "$e:$r{$k}\n"} for sort keys %r')}") fi commands=('env' $scripts $binaries)