Enable completion support for cli (#5552)

Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
This commit is contained in:
Marcus Ramberg
2025-09-28 21:32:00 +02:00
committed by GitHub
parent 272e7da5dc
commit d894d3a15b
2 changed files with 5 additions and 1 deletions

View File

@@ -31,7 +31,7 @@ func (c *Config) MergeIfNotSet(c2 *Config) {
}
}
var skipSetupForCommands = []string{"setup", "help", "h", "version", "update", "lint", "exec", ""}
var skipSetupForCommands = []string{"setup", "help", "h", "version", "update", "lint", "exec", "completion", ""}
func Load(ctx context.Context, c *cli.Command) error {
if firstArg := c.Args().First(); slices.Contains(skipSetupForCommands, firstArg) {

View File

@@ -41,6 +41,10 @@ func newApp() *cli.Command {
app.Before = common.Before
app.After = common.After
app.Suggest = true
app.ConfigureShellCompletionCommand = func(c *cli.Command) {
c.Hidden = false
c.Usage = "generate completion script for the specified shell"
}
app.Commands = []*cli.Command{
admin.Command,
exec.Command,