-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add getters for flagCompletionFunctions map to support interactive flag completion suggestions in cobra-prompt #1942
Comments
I made a PR #1943 PTAL at the proposal and tell me if you're okay with it |
Thanks @avirtopeanu-ionos. Could you give an example of where you would need to access the existing registered flag completions? I believe you should already be able to add new flag completions to another program. And I guess if you want to know if your flag completion already exists, you could try to register a new one and check for an error being returned? |
I may be misunderstanding something here. I don't want to add suggestions to the cobra command itself, I want to add the existing cobra suggestions from
If PR #1943 were to be merged, then this would add flag value completions to a
Here is my fork of cobra-prompt which uses PR #1943 for the getters https://github.com/avirtopeanu-ionos/cobra-prompt/tree/feat/add-flag-completions |
@marckhouzam I have edited my previous messages to hopefully provide more clarity to the described use case. By adding getters for the flagCompletionFunctions map, we can easily extend cobra and integrate it with completion/QOL packages like cobra-prompt. I hope this clears up any confusion. If you have any questions or concerns about this issue or PR #1943 please let me know |
Any update on this? We were considering making a fork of cobra if this PR #1943 shouldn't be merged |
#1943 was merged. Thank you! |
The flagCompletionFunctions map (https://github.com/spf13/cobra/blame/main/completions.go#L36) is used to store flag completion functions for a given command
I am working on extending the cobra-prompt library (https://github.com/stromland/cobra-prompt/) to add support for interactive flag completion suggestions. To achieve this, I need to access the flagCompletionFunctions map and retrieve the flag completion functions for a given command.
The text was updated successfully, but these errors were encountered: