dsifford / yarn-completion

Bash completion for Yarn
MIT License
277 stars 25 forks source link

Feature request: support workspaces whose names do not match their directory names #26

Closed Infiltrator closed 5 years ago

Infiltrator commented 5 years ago

packages.json:

{
  "workspaces": [
    "packages/*"
  ]
}

packages/bar/package.json:

{
  "name": "@foo/bar"
}

Trying completion: yarn workspace @foo/bar <TAB> or yarn workspace bar <TAB> gives completion for the root package.json instead.

dsifford commented 5 years ago

Thanks for the feedback.

Unfortunately, this is not reasonably possible using only posix-compliant bash. This would only be feasible to add if I were able to use something that could parse JSON but, in order to keep this cross-platform and dependency free, I don't have that luxury.

Infiltrator commented 5 years ago

So if there were bash code that could parse JSON, you would be willing to include it? Would it need to be a full JSON parser or just enough to read { "name": "@foo/bar" } out?