Skip to content

Support pretty-printing and colorizing JSON responses for the api command when using jq expressions #3994

@mestebangutierrez

Description

@mestebangutierrez

Describe the feature or problem you’d like to solve

When using the api command with a jq expression, the CLI currently does not pretty-print nor colorize the post-processed response, even though jq already supports both features. The resulting output nowadays is a compact JSON representation that may be quite difficult to interpret visually.

Proposed solution

This would be a nice to have when you are exploring the GitHub API leveraging the client during the development of integrations with the GitHub API.

A possibility would be to have the means to enable these behaviors -in case they should not be enabled by default for other reasons (i.e., performance or safety)- via additional api command flags:

$ gh api --jq <expression> --prettyprint --colorize <path>

Metadata

Metadata

Assignees

Labels

enhancementa request to improve CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions