gh-api:tldr:0098f
gh-api: Display the result of a GraphQL query in JSON format.
$ gh api graphql --field ${name=':repo'} --raw-field '${query}'
try on your machine
This command is using the GitHub CLI (gh) to make an API request to the GitHub GraphQL API.
Here's a breakdown of the command:
gh
: The GitHub CLI command.api
: Theapi
command in gh is used to make requests to the GitHub API.graphql
: This specifies that we want to make a GraphQL API request.
Options:
--field ${name=':repo'}
: This option specifies a field to include in the GraphQL query. In this case, it sets the:repo
variable to the value of thename
variable. The${name=':repo'}
syntax sets a default value for thename
variable to':repo'
if it is not provided by the user.--raw-field '${query}'
: This option specifies a raw GraphQL query to include. The${query}
syntax is used to include the value of thequery
variable. The GraphQL query should be enclosed in single quotes.
Overall, this command is using the GitHub CLI to make a GraphQL API request, passing the :repo
and query
variables into the GraphQL query.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.