-
Notifications
You must be signed in to change notification settings - Fork 32
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
Support values autocomplete in command and option #426
Comments
This issue has been linked to a new work item: W-12549907 |
Hi @tom10271, could you elaborate on what kind of autocomplete you mean for commands? So far only zsh autocomplete implementation for space-separated commands supports flag value completion: zsh autocomplete for colon-separated commands doesn't support it yet but seems easy to add now. Is there any interest in getting autocomplete for args that specify a known set of options? |
Mainly to support autocomplete for values that supplied from users which can be resolved by calling callback, for example I have a git helper and it asks for branch name. I have solved my problem with commander.js and will not use oclif at this moment. |
Ahh, I explored dynamic shell completion last year but wasn't able to implement it as I wasn't familiar with zsh/bash comp engine, should give it a try again. we could add support for a new prop in non-boolean flags/command args to assign a function that returns an array of strings, then most of the work will be in each shell autocomplete implementation as it will need a way to call that function (that works for npm, installer and tarball installations). |
I have dived deep into how autocomplete works recently. I might be able to create a doc explaining how things works and how to make it extensible by developers. The libraries I am using are I think line-info and completion are useful for oclif, yet please noted that these libraries were developed 10 years ago and tbh the documents written are not easy to understand and I have spent a lot of hours on guessing how it actually works. |
@tom10271 interesting, I'll take a look at that! All of the shell completion code for oclif lives here: https://github.com/oclif/plugin-autocomplete/ I've spent the last month writing a new autocomplete implementation for zsh and have some ideas about how to make it work there. Haven't touched bash completion yet and will start working on support for PowerShell next week so hopefully will have more data to make this work on all shells. See also dynamic completion in the Cobra framework: |
No description provided.
The text was updated successfully, but these errors were encountered: