'Github CLI - Grep for filtering by phrase in pull request body?
I’m using the Github CLI tool, which includes a command gh pr list
that allows you to see all the open pull requests.
The issue is that I only see a list of their titles and there’s a separate command gh pr view [extra info]
that actually allows you to see the body
.
I’m searching for pull requests that have a certain phrase in the BODY so gh pr list | grep “hello”
wouldn’t work because it only gives me pull requests with “hello”
in the header, and not necessarily the body.
How might I go about approaching this problem and are there any shortcuts in the github cli that might help me?
Solution 1:[1]
Sicne gh pr list
, like gh pr view
, does inherit from the same option --json <fields>
(Output JSON with the specified fields), you can use:
gh pr list --json number,body | grep "helllo"
That would grep for your specific message, and still give you an ID that you can use with gh pr view
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | VonC |