cli/issue: Replace manual pushing with Table::extend()

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2025-09-07 12:42:24 +02:00 committed by Lorenz Leutgeb
parent 8554e996b8
commit 2f28232676
1 changed files with 36 additions and 24 deletions

View File

@ -782,7 +782,7 @@ where
]); ]);
table.divider(); table.divider();
for (id, issue) in all { table.extend(all.into_iter().map(|(id, issue)| {
let assigned: String = issue let assigned: String = issue
.assignees() .assignees()
.map(|did| { .map(|did| {
@ -799,7 +799,23 @@ where
let author = issue.author().id; let author = issue.author().id;
let (alias, did) = Author::new(&author, profile, false).labels(); let (alias, did) = Author::new(&author, profile, false).labels();
table.push([ mk_issue_row(id, issue, assigned, labels, alias, did)
}));
table.print();
Ok(())
}
fn mk_issue_row(
id: cob::ObjectId,
issue: issue::Issue,
assigned: String,
labels: Vec<String>,
alias: radicle_term::Label,
did: radicle_term::Label,
) -> [radicle_term::Line; 8] {
[
match issue.state() { match issue.state() {
State::Open => term::format::positive("").into(), State::Open => term::format::positive("").into(),
State::Closed { .. } => term::format::negative("").into(), State::Closed { .. } => term::format::negative("").into(),
@ -820,11 +836,7 @@ where
.dim() .dim()
.italic() .italic()
.into(), .into(),
]); ]
}
table.print();
Ok(())
} }
fn open<R, G>( fn open<R, G>(