-
Notifications
You must be signed in to change notification settings - Fork 1.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
More powerful shell completion #1905
Comments
@bartekpacia I love this! Most of my recent programmable completion experience has been with click so the signature changes you are recommending make perfect sense to me. |
oh, and to answer your question about |
I did some research here: https://github.com/bartekpacia/random/blob/master/go/emux/README.md |
@bartekpacia is this still being worked on? |
Hey I kind of abandoned it for now, got distracted with other stuff |
Checklist
What problems are there currenty?
shell completions is only possible for commands - not for flags
ShellCompletionFunc
does not provide what the user has already entered in the promptWhat problem does this solve?
Currently
urfave/cli
allows for customizing shell completion only for commands.The Go module that does the best job at shell completions is cobra. Here are docs for it.
urfave/cli
is not Cobra and I hope it will never become one – it's much more lightweight, minimal, and fun - but I strongly believe that shell completions are a very useful feature.Proposed solution
ShellComplete
func for flags, for example:Additionally, both
ShellComplete
on flags and on command should provide the content of the prompt, so the developer can e.g. filter out duplicated completions:To avoid reinventing the wheel, completion shell scripts could be taken from Cobra (link). Deep dive & research is required to see if it fits into urfave/cli.
Summary of proposed changes
change type of
ShellCompleteFunc
from:to:
The presence and name of
ShellCompDirective
is tentative – but it's useful in Cobra.This ideally should be done before v3 stable gets released.
add
ShellComplete
field to all the flags –StringFlag
,IntFlag
. (What aboutBoolFlag
?)Describe alternatives you've considered
None.
See also
The text was updated successfully, but these errors were encountered: