In one of my previous posts I explained how to check the status of your PRs from the command line. Recently, I added one more improvement to ensure that also PRs without any reviews yet are listed with the PENDING state. This is achieved by using the fallback operator // in the jq: \(.reviews[-1].state // "PENDING") command.
gh pr list \
--author @me \
--json "number,title,reviews" \
| jq '.[] | "PR \(.number): \(.title) is \(.reviews[-1].state // "PENDING")"'
I also discovered (with some help from AI) how to watch the PR state live in full colour: combine the watch tool --color option with one of 2 environment variables:
watch --color 'GH_FORCE_TTY=1 gh pr view'
watch --color 'CLICOLOR_FORCE=1 gh pr view'
GH_FORCE_TTY=1: is theghspecific option and forces the GitHub CLI client to behave as it is running in a terminal, even if it's not (e.g. piped or run insidewatch).CLICOLOR_FORCE=1: is part of the CLICOLOR standard and affects other tools as well. It forces the tool to output colours regardless whether it is running in a terminal or not.
No comments:
Post a Comment