feat: View the repo maintainers as npub

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb
2025-06-29 20:19:54 +00:00
parent 45ea7d25f2
commit da284a084c
2 changed files with 10 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New `patch fetch` command to fetch patches - by Awiteb
- New `issue {reopen,close,resolve}` commands to manage issue status - by Awiteb
- New `patch` subcommands apply,close,draft,merge and reopen to manage the patch status - by Awiteb
- View the repo maintainers as `npub` - by Awiteb
### Dependencies

View File

@@ -17,6 +17,7 @@
use std::fmt;
use clap::Args;
use nostr::nips::nip19::ToBech32;
use crate::{
cli::{
@@ -78,7 +79,11 @@ impl CommandRunner for ViewArgs {
if !repo.maintainers.is_empty() {
repo_details.push_str(&format!(
"\nMaintainers:\n{}",
format_list(repo.maintainers)
format_list(
repo.maintainers
.iter()
.map(|p| p.to_bech32().expect("Infallible"))
)
));
}
repos_details.push(repo_details);
@@ -90,11 +95,12 @@ impl CommandRunner for ViewArgs {
}
/// Format a vector to print it
fn format_list<T>(vector: Vec<T>) -> String
fn format_list<I, T>(iterator: I) -> String
where
I: IntoIterator<Item = T>,
T: fmt::Display,
{
vector
iterator
.into_iter()
.map(|t| format!(" - {t}"))
.collect::<Vec<String>>()