-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Describe the feature or problem you’d like to solve
When using gh api, I would like to be able to use the expressive power of --jq to manipulate/filter the JSON response data, and then --template to render it, but currently that doesn't seem to be allowed:
- Incorrect error shown (the
--slurpoption is not supported with--jqor--template) when passing--jq+--templatewithout--slurp#10260-
Looking closer at that code, we can see there is an error case below this that I would have expected to be shown instead:
only one of
--template,--jq,--silent, or--verbosemay be usedLines 255 to 263 in 60f8417
if err := cmdutil.MutuallyExclusive( "only one of `--template`, `--jq`, `--silent`, or `--verbose` may be used", opts.Verbose, opts.Silent, opts.FilterOutput != "", opts.Template != "", ); err != nil { return err } Originally posted by @0xdevalias in Incorrect error shown (the
--slurpoption is not supported with--jqor--template) when passing--jq+--templatewithout--slurp#10260
-
Proposed solution
If it were possible to pass both --jq and --template together, then users would have more expressive ability to manipulate API response data through gh api without having to resort to moving to external tools/processing.
In particular, this would allow users to use --jq's deeper functionality for manipulation, while leveraging --template's simple/clean syntax for rendering the output.
Additional context
See also: