cli: Add filtering based on author to rad patch

My use case for this is to have a script that lists my outstanding
patches so I can ping people for review or merge if there's no
movement for a long time.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
Lars Wirzenius
2023-11-30 12:56:29 +01:00
committed by cloudhead
parent 72b00e3d41
commit df785aa0bf
4 changed files with 44 additions and 2 deletions
+8
View File
@@ -1,3 +1,5 @@
use std::collections::BTreeSet;
use radicle::cob::patch;
use radicle::cob::patch::{Patch, PatchId, Patches, Verdict};
use radicle::prelude::*;
@@ -15,6 +17,7 @@ use super::common;
/// List patches.
pub fn run(
filter: fn(&patch::State) -> bool,
authors: BTreeSet<Did>,
repository: &Repository,
profile: &Profile,
) -> anyhow::Result<()> {
@@ -29,6 +32,11 @@ pub fn run(
if !filter(patch.state()) {
continue;
}
if !authors.is_empty() {
if !authors.contains(patch.author().id()) {
continue;
}
}
all.push((id, patch));
}