Skip to content

Support getting both JSON and template output #8415

@rwalkerands

Description

@rwalkerands

Describe the feature or problem you’d like to solve

I'd like commands such as gh pr list to be able to give me both JSON output and to be able to apply a template.

The comment at #3012 (comment) notes as an aside:

Since filter and template are mutually exclusive ...

I'm using gh pr list in a (Bash) script that both generates pretty output for the user, and also does some other processing of the PRs.

I'd like to avoid having to run gh pr list twice.

What doesn't really work for me: add {{ . }} in the template. This gives me output in Go syntax, which I can't otherwise use.

Proposed solution

I have no particular preference for a solution. Obvious thought: add an option to output the JSON to a file.

Or, a completely different approach: add a new command that takes JSON input (from stdin and/or a file) and applies a template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussFeature changes that require discussion primarily among the GitHub CLI teamenhancementa request to improve CLIneeds-productAn issue that requires prioritization considerations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions