diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-20 22:41:50 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-20 22:41:50 +0000 |
| commit | 68779f91f051822270f156a4185350fb3c4b5017 (patch) | |
| tree | 2547eaf7cc74bddfb152baa4511c6a46b534d1a1 /src/lib/client.rs | |
| parent | 8f1a1743bd4e85e922ec0cc1f050911a28af4cf0 (diff) | |
improve `ngit repo` output formatting
- suppress fetch summary (no updates / updates: X)
- write blank line to stderr after relay errors for clear separation
- show identifier below title only when it differs from name
- show earliest unique commit (root_commit) in metadata
- restructure infrastructure into grasp servers / additional git
servers / additional relays sections
- display grasp servers by domain only (strip scheme, npub, repo path)
- strip wss:// prefix from relay display
- show maintainer names from metadata cache; fall back to short npub
- append (you) next to the current user's name wherever it appears
- show [name] attribution and the maintainer model note only when
there is more than one maintainer
Diffstat (limited to 'src/lib/client.rs')
| -rw-r--r-- | src/lib/client.rs | 36 |
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). | ||
| 2272 | pub 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 | |||
| 2268 | pub async fn get_proposals_and_revisions_from_cache( | 2304 | pub 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>, |