From 6279e1a4317215fba9cc0329da12e5ca00a35a40 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 6 Oct 2022 06:24:13 -0300 Subject: [PATCH] fix: annotate flags so they complete better (#3444) --- cmd/build.go | 1 + cmd/release.go | 1 + cmd/schema.go | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/build.go b/cmd/build.go index ab4ec1ff0d3..eb117046af9 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -81,6 +81,7 @@ When using ` + "`--single-target`" + `, the ` + "`GOOS`" + ` and ` + "`GOARCH`" cmd.Flags().StringArrayVar(&root.opts.ids, "id", nil, "Builds only the specified build ids") cmd.Flags().BoolVar(&root.opts.deprecated, "deprecated", false, "Force print the deprecation message - tests only") cmd.Flags().StringVarP(&root.opts.output, "output", "o", "", "Copy the binary to the path after the build. Only taken into account when using --single-target and a single id (either with --id or if configuration only has one build)") + _ = cmd.Flags().SetAnnotation("output", cobra.BashCompFilenameExt, []string{""}) _ = cmd.Flags().MarkHidden("deprecated") root.cmd = cmd diff --git a/cmd/release.go b/cmd/release.go index 009dba0efc3..7923420f62b 100644 --- a/cmd/release.go +++ b/cmd/release.go @@ -84,6 +84,7 @@ func newReleaseCmd() *releaseCmd { cmd.Flags().DurationVar(&root.opts.timeout, "timeout", 30*time.Minute, "Timeout to the entire release process") cmd.Flags().BoolVar(&root.opts.deprecated, "deprecated", false, "Force print the deprecation message - tests only") _ = cmd.Flags().MarkHidden("deprecated") + _ = cmd.Flags().SetAnnotation("config", cobra.BashCompFilenameExt, []string{"yaml", "yml"}) root.cmd = cmd return root diff --git a/cmd/schema.go b/cmd/schema.go index d3a4853d3b0..7a406d3711a 100644 --- a/cmd/schema.go +++ b/cmd/schema.go @@ -47,7 +47,8 @@ func newSchemaCmd() *schemaCmd { }, } - cmd.Flags().StringVarP(&root.output, "output", "o", "-", "where to save the json schema") + cmd.Flags().StringVarP(&root.output, "output", "o", "-", "Where to save the JSONSchema file") + _ = cmd.Flags().SetAnnotation("output", cobra.BashCompFilenameExt, []string{"json"}) root.cmd = cmd return root