diff options
| author | Shohei YOSHIDA <syohex@gmail.com> | 2021-12-08 00:19:46 +0900 |
|---|---|---|
| committer | Shohei YOSHIDA <syohex@gmail.com> | 2021-12-08 00:19:46 +0900 |
| commit | 2f54f2b21287a5753728feba1ae2abcbf9df2aab (patch) | |
| tree | 9bf11e89f08540cd5f0c1527658935088bddf902 /src/_yarn | |
| parent | Update collect workspaces command (diff) | |
| download | zsh-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/_yarn | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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 } |
