From 8cc4a21061433c9a29e36c4f33e4d84bea1defee Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 20 Dec 2024 08:07:22 +0000 Subject: refactor: use nostr url from repo_ref simplify to allow the removal of warning: `#[allow(clippy::too_many_arguments)]` --- src/bin/git_remote_nostr/main.rs | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/bin/git_remote_nostr/main.rs') diff --git a/src/bin/git_remote_nostr/main.rs b/src/bin/git_remote_nostr/main.rs index e6f7af3..44359dd 100644 --- a/src/bin/git_remote_nostr/main.rs +++ b/src/bin/git_remote_nostr/main.rs @@ -53,9 +53,11 @@ async fn main() -> Result<()> { fetching_with_report_for_helper(git_repo_path, &client, &decoded_nostr_url.coordinate).await?; - let repo_ref = + let mut repo_ref = get_repo_ref_from_cache(Some(git_repo_path), &decoded_nostr_url.coordinate).await?; + repo_ref.set_nostr_git_url(decoded_nostr_url.clone()); + let stdin = io::stdin(); let mut line = String::new(); @@ -77,21 +79,12 @@ async fn main() -> Result<()> { println!("unsupported"); } ["fetch", oid, refstr] => { - fetch::run_fetch( - &git_repo, - &repo_ref, - &decoded_nostr_url, - &stdin, - oid, - refstr, - ) - .await?; + fetch::run_fetch(&git_repo, &repo_ref, &stdin, oid, refstr).await?; } ["push", refspec] => { push::run_push( &git_repo, &repo_ref, - &decoded_nostr_url, &stdin, refspec, &client, @@ -100,12 +93,10 @@ async fn main() -> Result<()> { .await?; } ["list"] => { - list_outputs = - Some(list::run_list(&git_repo, &repo_ref, &decoded_nostr_url, false).await?); + list_outputs = Some(list::run_list(&git_repo, &repo_ref, false).await?); } ["list", "for-push"] => { - list_outputs = - Some(list::run_list(&git_repo, &repo_ref, &decoded_nostr_url, true).await?); + list_outputs = Some(list::run_list(&git_repo, &repo_ref, true).await?); } [] => { return Ok(()); -- cgit v1.2.3