_yarn: fix parsing of yarn run on scripts containing } (#668)

Fixes #667
This commit is contained in:
Marc Cornellà 2020-01-17 21:54:37 +01:00 committed by Maxim Devoir
parent 8def5f1583
commit e32536a208
1 changed files with 1 additions and 1 deletions

View File

@ -88,7 +88,7 @@ _yarn_scripts() {
runJSON=$(yarn run --json 2>/dev/null) runJSON=$(yarn run --json 2>/dev/null)
binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON")) binaries=($(sed -E '/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON"))
scriptNames=($(sed -E '/possibleCommands/!d;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON")) scriptNames=($(sed -E '/possibleCommands/!d;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\n/g' <<< "$runJSON"))
scriptCommands=("${(@f)$(sed -E '/possibleCommands/!d;s/.*"hints":\{([^}]+)\}.*/\1/;s/"[^"]+"://g;s/:/\\:/g;s/","/\n/g;s/(^"|"$)//g' <<< "$runJSON")}") scriptCommands=("${(@f)$(sed -E '/possibleCommands/!d;s/.*"hints":\{(.+")\}.*/\1/;s/"[^"]+"://g;s/:/\\:/g;s/","/\n/g;s/(^"|"$)//g' <<< "$runJSON")}")
for (( i=1; i <= $#scriptNames; i++ )); do for (( i=1; i <= $#scriptNames; i++ )); do
scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}") scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}")