upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/client.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/client.rs b/src/lib/client.rs
index 68b7e1c..32c2d37 100644
--- a/src/lib/client.rs
+++ b/src/lib/client.rs
@@ -2265,6 +2265,42 @@ pub async fn fetching_with_report(
2265 Ok(report) 2265 Ok(report)
2266} 2266}
2267 2267
2268/// Like `fetching_with_report` but suppresses the "no updates" / "updates: X"
2269/// summary line. Returns `true` if any relay reported an error (so the caller
2270/// can print a blank line to visually separate relay-error output from
2271/// subsequent content).
2272pub async fn fetching_quietly(
2273 git_repo_path: &Path,
2274 #[cfg(test)] client: &crate::client::MockConnect,
2275 #[cfg(not(test))] client: &Client,
2276 trusted_maintainer_coordinate: &Nip19Coordinate,
2277) -> Result<(FetchReport, bool)> {
2278 let verbose = is_verbose();
2279 if verbose {
2280 let term = console::Term::stderr();
2281 term.write_line("Checking nostr relays...")?;
2282 }
2283 let (relay_reports, progress_reporter) = client
2284 .fetch_all(
2285 Some(git_repo_path),
2286 Some(trusted_maintainer_coordinate),
2287 &HashSet::new(),
2288 )
2289 .await?;
2290 let had_errors = relay_reports.iter().any(std::result::Result::is_err);
2291 if !had_errors {
2292 let _ = progress_reporter.clear();
2293 }
2294 // Drop the MultiProgress now so all buffered stderr output is flushed
2295 // before we write the separator blank line.
2296 drop(progress_reporter);
2297 if had_errors {
2298 let _ = console::Term::stderr().write_line("");
2299 }
2300 let report = consolidate_fetch_reports(relay_reports);
2301 Ok((report, had_errors))
2302}
2303
2268pub async fn get_proposals_and_revisions_from_cache( 2304pub async fn get_proposals_and_revisions_from_cache(
2269 git_repo_path: &Path, 2305 git_repo_path: &Path,
2270 repo_coordinates: HashSet<Nip19Coordinate>, 2306 repo_coordinates: HashSet<Nip19Coordinate>,