浏览代码

fix(yarn): update completion (#10579)

Fixes #10578
Carlo Sala 2 年之前
父节点
当前提交
93cea53618
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      plugins/yarn/_yarn

+ 2 - 2
plugins/yarn/_yarn

@@ -116,7 +116,7 @@ _yarn_commands_scripts() {
   fi
   fi
 
 
   if [[ -n $packageJson ]]; then
   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
   fi
 
 
   _describe 'command or script' _commands -- _global_commands -- scripts -- binaries
   _describe 'command or script' _commands -- _global_commands -- scripts -- binaries
@@ -144,7 +144,7 @@ _yarn_scripts() {
   fi
   fi
 
 
   if [[ -n $packageJson ]]; then
   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
   fi
 
 
   commands=('env' $scripts $binaries)
   commands=('env' $scripts $binaries)