-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI auto completion #609
Comments
Hi I came here to suggest an auto-completion feature for yarn. Saw this so thought I'd comment here to flag my interest. Yarn like npm has a lot of commands and I often use npm's auto-completion. Would help people switching to yarn. |
There is yarn-completions There is also a completion-plugin for oh-my-zsh. |
@cjk How does that even work? I installed yarn-completions - didn't work. Realized it's actually some kind of plugin for tabtab, so I installed that. Still doesn't work. Re-sourced my bash profile. Still doesn't work. Is there really more configuration required? It'd be really nice to have this functionality included in yarn itself. |
@cjk yarn-completions works great, thanks for the suggestion! It would be very useful to include that plugin into Yarn itself |
@Matmo10 did you ever get completions working? |
Didn't see @Matmo10's comment unfortunately. I spent the day today writing a pretty feature-complete bash completion, including computed autocomplete for scripts, local and global package names, and more. If anybody is still in the market for it, you can find it here. https://github.com/dsifford/yarn-completion Maintainer: If this is something you'd like for me to PR into this project directly, I'd be glad to do that as well. Thanks 👍 |
I'm thankful for that, because your solution is much better 👍 |
@pesho Thanks! Glad to hear you like it 😄 |
FYI: just pushed an update which makes the completions feature-complete up to yarn |
For zsh users, the |
Please make developers happier! Include completions developed by @dsifford to official package. Npm has command |
Yes please do. |
Maintainers: This issue is labeled "needs discussion". Is it possible to provide direction on what needs to be discussed for this to become a first-class feature of yarn? Or is the required discussion regarding whether it should be part of yarn? Thanks! |
Yes, I would love to discuss this a bit more... or get it implemented. I don't understand why it is missing |
Any update on the status of this? |
Is any of the suggestions above working good for zsh? Seemed to be bash specific…? I still lean on npm to just help me with my own scripts in package.json. Hate to have
|
Guys any update on this? Any way to integrate autocomplete inside yarn? |
guys we can close this finally, every one has moved to pnpm since yarn is a dead project. |
This was inspired by wanting to add tab completion inside the development container for our miscellaneous development scripts. Reading through the issue on it (yarnpkg/yarn#609), it really drove home the fact that yarn v1 is unmaintained and slowly dying. In the meantime, npm has more than caught up with the main innovations that yarn originally introduced while yarn v3 has made extremely opinionated choices around PnP, package patching, etc. that I disagree with. I've always really liked pnpm too, but their linking strategy with the global store doesn't really adapt well to the docker volume mount approach we use here. This PR switches us over to using vanilla npm as the package manager. The changes are fairly straightforward from a developer perspective. You mainly do `npm run <script>` instead of `yarn <script>` and expect the lock file changes to be in `package-lock.json` insted of `yarn.lock`. The canonical forms for some other commands are different, but npm provides aliases that make the yarn forms work for the most common stuff: `npm install --save-dev <package>` is canonical but `npm add -D <package>` works, `npm uninstall <package>` and `npm remove <package>` both work, etc. I additionally added tab completion in the docker container, so you can tab complete any of the npm commands/arguments including our own scripts. Merges #100 LGTM given by: @jason-sindri
There is another alternative which I've been using a few years - https://github.com/romainberger/yarn-completion Install globally and add bash file to somewhere like bash_completions and adjust the instructions as required. If you run into One other minor bug is it doesn't work well with scripts with a |
Something npm has always bugged me is auto completion.
It requires putting
source <(npm completion)
to myzshrc
, which is extremely slow and seldom outputs useful completion.A few examples yarn could do:
letting
yarn <Tab>
outputs all commands:letting each flag output useful information:
yarn install -<Tab>
letting
yarn install <Tab>
prompt a list of cached packages:yarn install r<Tab>
letting
yarn rm <Tab>
list packages installed locallyyarn rm r<Tab>
Thanks for the good work!
The text was updated successfully, but these errors were encountered: