diff --git a/CHANGELOG.md b/CHANGELOG.md index 09acdb4..1472618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/cli/commands/repo/view.rs b/src/cli/commands/repo/view.rs index 583e726..4f0e73e 100644 --- a/src/cli/commands/repo/view.rs +++ b/src/cli/commands/repo/view.rs @@ -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(vector: Vec) -> String +fn format_list(iterator: I) -> String where + I: IntoIterator, T: fmt::Display, { - vector + iterator .into_iter() .map(|t| format!(" - {t}")) .collect::>()