Skip to content

Commit

Permalink
fix: annotate flags so they complete better (#3444)
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Oct 6, 2022
1 parent c6e092a commit 6279e1a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/build.go
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cmd/release.go
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cmd/schema.go
Expand Up @@ -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
Expand Down

0 comments on commit 6279e1a

Please sign in to comment.