scripts=($(cd$opt_args[--cwd]&& yarn run --json 2>/dev/null | sed-E'/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed-e's/:/\\:/g'))
else
scripts=($(yarn run --json 2>/dev/null | sed-E'/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed-e's/:/\\:/g'))
scripts=($(yarn run --json 2>/dev/null | sed-E'/Commands available|possibleCommands/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g' | tr , '\n' | sed-e's/:/\\:/g'))
fi
_describe 'command or script' _commands -- _global_commands -- scripts
_describe 'command or script' _commands -- _global_commands -- scripts
}
}
...
@@ -85,7 +101,11 @@ _yarn_scripts() {
...
@@ -85,7 +101,11 @@ _yarn_scripts() {
local-a scriptNames scriptCommands
local-a scriptNames scriptCommands
local i runJSON
local i runJSON
if[[-n$_yarn_run_cwd]];then
runJSON=$(cd$_yarn_run_cwd&& yarn run --json 2>/dev/null)
else
runJSON=$(yarn run --json 2>/dev/null)
runJSON=$(yarn run --json 2>/dev/null)
fi
# Some sed utilities (e.g. Mac OS / BSD) don't interpret `\n` in a replacement
# 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
# 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"))
binaries=($(sed-E'/Commands available/!d;s/.*Commands available from binary scripts: ([^"]+)".*/\1/;s/.*"items":\[([^]]+).*/\1/;s/[" ]//g;s/:/\\:/g;s/,/\'$'\n/g'<<<"$runJSON"))