diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-13 08:10:50 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-13 08:10:50 +0000 |
| commit | 64f1cf4f8e021f52f8e7df75e62f10d32d9fa101 (patch) | |
| tree | b47f3cf4e213642ccd281b809dbb990968fb34fc | |
| parent | 990ac9fb6d4b2e862614632f1f17a6f671c72f5b (diff) | |
fix: clear progress reporters on successful completion
Progress reporters were not being cleared after successful operations,
leaving progress bars visible in the terminal output. Now they are
properly cleared when all operations complete without errors.
| -rw-r--r-- | src/bin/git_remote_nostr/main.rs | 3 | ||||
| -rw-r--r-- | src/lib/list.rs | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/bin/git_remote_nostr/main.rs b/src/bin/git_remote_nostr/main.rs index 618aff7..b26981d 100644 --- a/src/bin/git_remote_nostr/main.rs +++ b/src/bin/git_remote_nostr/main.rs | |||
| @@ -157,7 +157,7 @@ async fn fetching_with_report_for_helper( | |||
| 157 | ) -> Result<()> { | 157 | ) -> Result<()> { |
| 158 | let term = console::Term::stderr(); | 158 | let term = console::Term::stderr(); |
| 159 | term.write_line("nostr: fetching...")?; | 159 | term.write_line("nostr: fetching...")?; |
| 160 | let (relay_reports, _progress_reporter) = client | 160 | let (relay_reports, progress_reporter) = client |
| 161 | .fetch_all( | 161 | .fetch_all( |
| 162 | Some(git_repo_path), | 162 | Some(git_repo_path), |
| 163 | Some(trusted_maintainer_coordinate), | 163 | Some(trusted_maintainer_coordinate), |
| @@ -170,5 +170,6 @@ async fn fetching_with_report_for_helper( | |||
| 170 | } else { | 170 | } else { |
| 171 | term.write_line(&format!("nostr updates: {report}"))?; | 171 | term.write_line(&format!("nostr updates: {report}"))?; |
| 172 | } | 172 | } |
| 173 | progress_reporter.clear()?; | ||
| 173 | Ok(()) | 174 | Ok(()) |
| 174 | } | 175 | } |
diff --git a/src/lib/list.rs b/src/lib/list.rs index cb26c19..ce8737c 100644 --- a/src/lib/list.rs +++ b/src/lib/list.rs | |||
| @@ -333,18 +333,23 @@ pub async fn list_from_remotes( | |||
| 333 | .await; | 333 | .await; |
| 334 | 334 | ||
| 335 | let mut remote_states = HashMap::new(); | 335 | let mut remote_states = HashMap::new(); |
| 336 | let mut all_succeeded = true; | ||
| 336 | for result in results { | 337 | for result in results { |
| 337 | match result { | 338 | match result { |
| 338 | Ok((url, state, is_grasp_server)) => { | 339 | Ok((url, state, is_grasp_server)) => { |
| 339 | remote_states.insert(url, (state, is_grasp_server)); | 340 | remote_states.insert(url, (state, is_grasp_server)); |
| 340 | } | 341 | } |
| 341 | Err((url, error)) => { | 342 | Err((url, error)) => { |
| 342 | // Errors are already displayed in progress bars | 343 | all_succeeded = false; |
| 343 | let _ = term.write_line(&format!("failed to list from {}: {}", url, error)); | 344 | let _ = term.write_line(&format!("failed to list from {}: {}", url, error)); |
| 344 | } | 345 | } |
| 345 | } | 346 | } |
| 346 | } | 347 | } |
| 347 | 348 | ||
| 349 | if all_succeeded { | ||
| 350 | let _ = progress_reporter.clear(); | ||
| 351 | } | ||
| 352 | |||
| 348 | remote_states | 353 | remote_states |
| 349 | } | 354 | } |
| 350 | 355 | ||