diff options
Diffstat (limited to 'src/bin/git_remote_nostr/main.rs')
| -rw-r--r-- | src/bin/git_remote_nostr/main.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/bin/git_remote_nostr/main.rs b/src/bin/git_remote_nostr/main.rs index 6186ed3..dad8a99 100644 --- a/src/bin/git_remote_nostr/main.rs +++ b/src/bin/git_remote_nostr/main.rs | |||
| @@ -12,7 +12,9 @@ use std::{ | |||
| 12 | }; | 12 | }; |
| 13 | 13 | ||
| 14 | use anyhow::{Context, Result, bail}; | 14 | use anyhow::{Context, Result, bail}; |
| 15 | use client::{Connect, consolidate_fetch_reports, get_repo_ref_from_cache, is_verbose}; | 15 | use client::{ |
| 16 | Connect, FetchReport, consolidate_fetch_reports, get_repo_ref_from_cache, is_verbose, | ||
| 17 | }; | ||
| 16 | use git::{RepoActions, nostr_url::NostrUrlDecoded}; | 18 | use git::{RepoActions, nostr_url::NostrUrlDecoded}; |
| 17 | use ngit::{ | 19 | use ngit::{ |
| 18 | client::{self, Params}, | 20 | client::{self, Params}, |
| @@ -149,7 +151,9 @@ async fn main() -> Result<()> { | |||
| 149 | client.set_signer(signer).await; | 151 | client.set_signer(signer).await; |
| 150 | } | 152 | } |
| 151 | 153 | ||
| 152 | fetching_with_report_for_helper(git_repo_path, &client, &decoded_nostr_url.coordinate).await?; | 154 | let fetch_report = |
| 155 | fetching_with_report_for_helper(git_repo_path, &client, &decoded_nostr_url.coordinate) | ||
| 156 | .await?; | ||
| 153 | 157 | ||
| 154 | let mut repo_ref = | 158 | let mut repo_ref = |
| 155 | get_repo_ref_from_cache(Some(git_repo_path), &decoded_nostr_url.coordinate).await?; | 159 | get_repo_ref_from_cache(Some(git_repo_path), &decoded_nostr_url.coordinate).await?; |
| @@ -221,10 +225,12 @@ async fn main() -> Result<()> { | |||
| 221 | push_options = PushOptions::default(); | 225 | push_options = PushOptions::default(); |
| 222 | } | 226 | } |
| 223 | ["list"] => { | 227 | ["list"] => { |
| 224 | list_outputs = Some(list::run_list(&git_repo, &repo_ref, false).await?); | 228 | list_outputs = |
| 229 | Some(list::run_list(&git_repo, &repo_ref, false, &fetch_report).await?); | ||
| 225 | } | 230 | } |
| 226 | ["list", "for-push"] => { | 231 | ["list", "for-push"] => { |
| 227 | list_outputs = Some(list::run_list(&git_repo, &repo_ref, true).await?); | 232 | list_outputs = |
| 233 | Some(list::run_list(&git_repo, &repo_ref, true, &fetch_report).await?); | ||
| 228 | } | 234 | } |
| 229 | [] => { | 235 | [] => { |
| 230 | return Ok(()); | 236 | return Ok(()); |
| @@ -283,7 +289,7 @@ async fn fetching_with_report_for_helper( | |||
| 283 | git_repo_path: &Path, | 289 | git_repo_path: &Path, |
| 284 | client: &Client, | 290 | client: &Client, |
| 285 | trusted_maintainer_coordinate: &Nip19Coordinate, | 291 | trusted_maintainer_coordinate: &Nip19Coordinate, |
| 286 | ) -> Result<()> { | 292 | ) -> Result<FetchReport> { |
| 287 | let term = console::Term::stderr(); | 293 | let term = console::Term::stderr(); |
| 288 | let verbose = is_verbose(); | 294 | let verbose = is_verbose(); |
| 289 | if verbose { | 295 | if verbose { |
| @@ -308,7 +314,7 @@ async fn fetching_with_report_for_helper( | |||
| 308 | } else { | 314 | } else { |
| 309 | term.write_line(&format!("nostr updates: {report}"))?; | 315 | term.write_line(&format!("nostr updates: {report}"))?; |
| 310 | } | 316 | } |
| 311 | Ok(()) | 317 | Ok(report) |
| 312 | } | 318 | } |
| 313 | 319 | ||
| 314 | #[cfg(test)] | 320 | #[cfg(test)] |