dsifford / yarn-completion

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

Feature request: NPM repository autocomplete #32

Closed EdwardDrapkin closed 5 years ago

EdwardDrapkin commented 5 years ago

Would be nice if yarn add re<tab> completed into react, react-dom, react-router, etc.

dsifford commented 5 years ago

Hi @EdwardDrapkin,

I get the appeal for this definitely, but unfortunately it's not feasible without introducing non-posix dependencies and a significant amount of overhead which is not something I'd be willing to do.

The reason why we're able to complete other types of things (package.json "scripts" for example) is because they're able to be parsed out of a file on your local system without any network I/O and with only posix utilities (sed/awk/etc). Hitting npm's API would not only require introducing network I/O, but also introducing some type of robust json-parsing dependency to the script (such as jq, or something similar).

Hopefully that makes sense. Thanks for the feedback.