aboutsummaryrefslogtreecommitdiffstats
path: root/src/_yarn
diff options
context:
space:
mode:
authorShohei YOSHIDA <syohex@gmail.com>2021-12-08 00:19:46 +0900
committerShohei YOSHIDA <syohex@gmail.com>2021-12-08 00:19:46 +0900
commit2f54f2b21287a5753728feba1ae2abcbf9df2aab (patch)
tree9bf11e89f08540cd5f0c1527658935088bddf902 /src/_yarn
parentUpdate collect workspaces command (diff)
downloadzsh-completions-2f54f2b21287a5753728feba1ae2abcbf9df2aab.tar
zsh-completions-2f54f2b21287a5753728feba1ae2abcbf9df2aab.tar.gz
zsh-completions-2f54f2b21287a5753728feba1ae2abcbf9df2aab.tar.bz2
zsh-completions-2f54f2b21287a5753728feba1ae2abcbf9df2aab.tar.lz
zsh-completions-2f54f2b21287a5753728feba1ae2abcbf9df2aab.tar.xz
zsh-completions-2f54f2b21287a5753728feba1ae2abcbf9df2aab.tar.zst
zsh-completions-2f54f2b21287a5753728feba1ae2abcbf9df2aab.zip
Support both older and newer versions
Diffstat (limited to 'src/_yarn')
-rw-r--r--src/_yarn8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/_yarn b/src/_yarn
index b443e53..1e39837 100644
--- a/src/_yarn
+++ b/src/_yarn
@@ -137,7 +137,13 @@ _yarn_add_files() {
}
_yarn_workspaces() {
- local -a workspaces=(${(@f)$(yarn workspaces list --json | sed -n 's|.*"name":"\([^"]*\)"}|\1|p')})
+ local version=$(yarn --version |sed -n 's|\([0-9]*\).*|\1|p')
+ local -a workspaces
+ if [[ $version == "1" ]]; then
+ workspaces=(${(@f)$(yarn workspaces info |sed -n -e 's/^ "\([^"]*\)": {/\1/p')})
+ else
+ workspaces=(${(@f)$(yarn workspaces list --json | sed -n 's|.*"name":"\([^"]*\)"}|\1|p')})
+ fi
_describe 'workspace' workspaces
}