From cd63b0eac541fd8ae9b9f8e3d5a780eaacb499db Mon Sep 17 00:00:00 2001 From: Heath Stewart Date: Sat, 17 Sep 2022 23:12:48 -0700 Subject: [PATCH] Add more help to "template" flags Resolves #6089 --- pkg/cmd/api/api.go | 2 +- pkg/cmdutil/json_flags.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cmd/api/api.go b/pkg/cmd/api/api.go index ed1348984..eac761be1 100644 --- a/pkg/cmd/api/api.go +++ b/pkg/cmd/api/api.go @@ -219,7 +219,7 @@ func NewCmdApi(f *cmdutil.Factory, runF func(*ApiOptions) error) *cobra.Command cmd.Flags().BoolVar(&opts.Paginate, "paginate", false, "Make additional HTTP requests to fetch all pages of results") cmd.Flags().StringVar(&opts.RequestInputFile, "input", "", "The `file` to use as body for the HTTP request (use \"-\" to read from standard input)") cmd.Flags().BoolVar(&opts.Silent, "silent", false, "Do not print the response body") - cmd.Flags().StringVarP(&opts.Template, "template", "t", "", "Format the response using a Go template") + cmd.Flags().StringVarP(&opts.Template, "template", "t", "", "Format JSON output using a Go template; see \"gh help formatting\"") cmd.Flags().StringVarP(&opts.FilterOutput, "jq", "q", "", "Query to select values from the response using jq syntax") cmd.Flags().DurationVar(&opts.CacheTTL, "cache", 0, "Cache the response, e.g. \"3600s\", \"60m\", \"1h\"") return cmd diff --git a/pkg/cmdutil/json_flags.go b/pkg/cmdutil/json_flags.go index 2d327c337..3d44c0ada 100644 --- a/pkg/cmdutil/json_flags.go +++ b/pkg/cmdutil/json_flags.go @@ -27,7 +27,7 @@ func AddJSONFlags(cmd *cobra.Command, exportTarget *Exporter, fields []string) { f := cmd.Flags() f.StringSlice("json", nil, "Output JSON with the specified `fields`") f.StringP("jq", "q", "", "Filter JSON output using a jq `expression`") - f.StringP("template", "t", "", "Format JSON output using a Go template") + f.StringP("template", "t", "", "Format JSON output using a Go template; see \"gh help formatting\"") _ = cmd.RegisterFlagCompletionFunc("json", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { var results []string