get

Function get 

Source
pub fn get(
    repo: &str,
    search: Option<&str>,
    retain_fn: &dyn Fn(&PullRequest) -> bool,
) -> Result<Vec<PullRequest>>
Expand description

Fetch pull requests for a repository using gh pr list.

Requests the JSON fields: number,title,author,mergeStateStatus,updatedAt. The updated_at timestamp (UTC) enables client‑side freshness sorting, stale PR detection, and activity‑based filtering without an additional API round‑trip.

§Errors

  • Spawning or executing gh pr list fails.
  • Command exits non‑zero (handled inside [ytil_cmd::CmdExt]).
  • Output JSON cannot be deserialized.

§Rationale

Accepting Option<&str> for search cleanly distinguishes absence vs empty and avoids forcing callers to include flag/quoting. Using a trait object for the predicate avoids generic inference issues when passing None.

§Future Work

  • Expose pagination (currently relies on gh default limit).