Allow to customize shell completion #2102
suzuki-shunsuke
started this conversation in
Ideas
Replies: 2 comments
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
I created a pull request. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://cli.urfave.org/v3/examples/completions/shell-completions/
What
EnableShellCompletion: trueis useful, but I'd like to customize the command's description, usage, andHidden.I don't want to hide
completioncommand because users run this command.cli/completion.go
Line 45 in c88e6fc
Current problem
Command.Runadds a sub commandcompletionifEnableShellCompletionis true, but there is no way to customize the command.cli/command_run.go
Lines 93 to 95 in 103c934
cli/command_setup.go
Lines 91 to 105 in 103c934
If you add a command
completionexplicitly,EnableShellCompletiondoes nothing becausecmd.appendCommand(completionCommand)skips adding a command and doesn't change the customcompletioncommand.cli/command.go
Lines 299 to 304 in c88e6fc
If
buildCompletionCommandis public, you can create a completion command and customize it and append it to Commands,but actually
buildCompletionCommandis private.https://cli.urfave.org/v3/examples/completions/shell-completions/ refers how to customize the completion command, but
it doesn't work fineit doesn't customize completion command fields such asHidden.How to solve
I propose two options.
buildCompletionCommandI disagree the option 1.
By option 2, you can cusomize the completion command.
Beta Was this translation helpful? Give feedback.
All reactions