-
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
Expose shell completions scripts in by default in the completion
command
#1904
Comments
completion
command
@bartekpacia I dont understand. The "generate-completion" is a hidden command in urfave/cli/v3. So if user invokes
It will output the zsh completion script which can be copied by user and sourced. |
@dearchap Thank you for pointing it out – I wasn't aware of it. It doesn't look like this feature is documented anywhere yet – but this may be actually a good thing, because v3 is at alpha, so we could:
|
@bartekpacia Thank you for bringing this up!
SGTM 👍🏼
SGTM 👍🏼
SGTM 👍🏼 WDYT about creating targeted issues for each of these? |
@meatballhat I think all these changes should be ideally made in a single PR, to keep them atomic and easy to revert - so a single issue to track them is enough for me. That said if you disagree I can of course create the issues. |
@bartekpacia Single issue also works for me 👍🏼 I didn't want to pressure you (or anyone else) to get it all done in one shot 😁 |
@bartekpacia do you want to take this up ? |
@dearchap yes! I assigned myself:) no promise on the timeline though I'd like to get it done in the next month or so:( |
Checklist
What problem does this solve?
Makes it easier for developers to add shell completion to the CLI tools they're building with
urfave/cli/v3
. This would make completion installation the same as the popular Cobra library, that is:myapp completion zsh
prints the completion script forzsh
. The user of the CLI gets to decide what to do with it:myapp completion zsh > /opt/homebrew/share/zsh/site-functions/_myapp
(on macOS), or. <(myapp completion zsh)
We already have completion scripts in this repository for all major popular shells (
bash
,zsh
,pwsh
), and furthermore, these scripts are already bundled with the module:cli/completion.go
Lines 14 to 16 in 204d34f
Solution description
By default, each CLI app made with
urfave/cli/v3
should have thecompletion
command (hidden by default)I don't think this could be brought into
v2
, because it would break if the developer already defined thecompletion
command.Describe alternatives you've considered
The alternative is the current situation – developers have to copy , which is unnecessary work, given that the completion files are embedded in
urfave/cli
anyway.Resources used
The text was updated successfully, but these errors were encountered: