summaryrefslogtreecommitdiff
path: root/plugins/yarn/_yarn
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2020-01-19 13:39:18 +0100
committerMarc Cornellà <marc.cornella@live.com>2020-01-19 13:39:18 +0100
commitce298d090b737cbce2a87afaada2195b0bb2e801 (patch)
tree85fd6755f70274f362edcd5b17c2dda3de7918bb /plugins/yarn/_yarn
parent56297902e9d0f7a14f6d4d88b24eaea7392f3c32 (diff)
downloadzsh-ce298d090b737cbce2a87afaada2195b0bb2e801.tar.gz
zsh-ce298d090b737cbce2a87afaada2195b0bb2e801.tar.bz2
zsh-ce298d090b737cbce2a87afaada2195b0bb2e801.zip
yarn: use zsh-completions latest version (493984e)
Diffstat (limited to 'plugins/yarn/_yarn')
-rw-r--r--plugins/yarn/_yarn8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn
index 3689ae960..70e783b86 100644
--- a/plugins/yarn/_yarn
+++ b/plugins/yarn/_yarn
@@ -86,9 +86,11 @@ _yarn_scripts() {
local i runJSON
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"))
- 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")}")
+ # Some sed utilities (e.g. Mac OS / BSD) don't interpret `\n` in a replacement
+ # pattern as a newline. See https://superuser.com/q/307165
+ 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"))
+ 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
scripts+=("${scriptNames[$i]}:${scriptCommands[$i]}")