}, "number": 124, "title": "Improve the docs" }, { "author": { "login": "cli-maintainer" }, "number": 125, "title": "An exciting new feature" } ] # Adding the --jq flag and selecting fields from the array $ gh pr list --json author --jq '.[].author.login' monalisa codercat cli-maintainer # --jq can be used to implement more complex filtering and output changes $ gh issue list --json number,title,labels --jq \ 'map(select((.labels | length) > 0)) # must have labels | map(.labels = (.labels | map(.name))) # show only the label names | .[:3] # select the first 3 results' [ { "labels": [ "enhancement", "needs triage" ], "number": 123, "title": "A helpful contribution" }, { "labels": [ "help wanted", "docs", "good first issue" ], "number": 125, "title": "Improve the docs" }, { "labels": [ "enhancement", ], "number": 7221, "title": "An exciting new feature" } ] # Using the --template flag with the hyperlink helper $ gh issue list --json title,url --template '{{range .}}{{hyperlink .url .title}}{{"\n"}}{{end}}' # Adding the --template flag and modifying the display format $ gh pr list --json number,title,headRefName,updatedAt --template \ '{{range .}}{{tablerow (printf "#%v" .number | autocolor "green") .title .headRefName (timeago .updatedAt)}}{{end}}' #123 A helpful contribution contribution-branch about 1 day ago #124 Improve the docs docs-branch about 2 days ago #125 An exciting new feature feature-branch about 2 days ago # A more complex example with the --template flag which formats a pull request using multiple tables with headers $ gh pr view 3519 --json number,title,body,reviews,assignees --template \ '{{printf "#%v" .number}} {{.title}} {{.body}} {{tablerow "ASSIGNEE" "NAME"}}{{range .assignees}}{{tablerow .login .name}}{{end}}{{tablerender}} {{tablerow "REVIEWER" "STATE" "COMMENT"}}{{range .reviews}}{{tablerow .author.login .state .body}}{{end}} ' #3519 Add table and helper template functions Resolves #3488 ASSIGNEE NAME mislav Mislav Marohnić REVIEWER STATE COMMENT mislav COMMENTED This is going along great! Thanks for working on this ❤️