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: true
is useful, but I'd like to customize the command's description, usage, andHidden
.I don't want to hide
completion
command because users run this command.cli/completion.go
Line 45 in c88e6fc
Current problem
Command.Run
adds a sub commandcompletion
ifEnableShellCompletion
is 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
completion
explicitly,EnableShellCompletion
does nothing becausecmd.appendCommand(completionCommand)
skips adding a command and doesn't change the customcompletion
command.cli/command.go
Lines 299 to 304 in c88e6fc
If
buildCompletionCommand
is public, you can create a completion command and customize it and append it to Commands,but actually
buildCompletionCommand
is 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.
buildCompletionCommand
I disagree the option 1.
By option 2, you can cusomize the completion command.
Beta Was this translation helpful? Give feedback.
All reactions