93cea53618ebd3f108275c88c948f790492337b4
- Author
- Carlo Sala <carlosalag@protonmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
fix(yarn): update completion (#10579)
Fixes #10578
Diff
1diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn
2index 9db02602ed35a8c11c695cd9945f4c0e6378dcf9..1237ba672daae0211f1ad192c8db7d97df3ee520 100644
3--- a/plugins/yarn/_yarn
4+++ b/plugins/yarn/_yarn
5@@ -116,7 +116,7 @@ _yarn_commands_scripts() {
6 fi
7
8 if [[ -n $packageJson ]]; then
9- scripts=($(cat "$packageJson" | perl -0777 -MJSON::PP -n -E '%r=decode_json($_); say for sort keys %{$r->{scripts}}'))
10+ scripts=($(cat "$packageJson" | perl -0777 -MJSON::PP -n -E '$r=decode_json($_); do{($k=$_)=~s/:/\\:/g;say $k}for sort keys %{$r->{scripts}}'))
11 fi
12
13 _describe 'command or script' _commands -- _global_commands -- scripts -- binaries
14@@ -144,7 +144,7 @@ _yarn_scripts() {
15 fi
16
17 if [[ -n $packageJson ]]; then
18- scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E '%r=%{decode_json($_)->{scripts}}; printf "$_:$r{$_}\n" for sort keys %r')}")
19+ 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')}")
20 fi
21
22 commands=('env' $scripts $binaries)