From 949c6459aa7683453a7160423b689ceadb08954b Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 4 Sep 2024 08:04:48 +0100 Subject: refactor: organise into lib and bin structure the make the code more readable this commit just moves the files, the next commit should fix the imports --- src/sub_commands/fetch.rs | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 src/sub_commands/fetch.rs (limited to 'src/sub_commands/fetch.rs') diff --git a/src/sub_commands/fetch.rs b/src/sub_commands/fetch.rs deleted file mode 100644 index b1e83c5..0000000 --- a/src/sub_commands/fetch.rs +++ /dev/null @@ -1,44 +0,0 @@ -use std::collections::HashSet; - -use anyhow::{Context, Result}; -use clap; -use nostr::nips::nip01::Coordinate; - -#[cfg(not(test))] -use crate::client::Client; -#[cfg(test)] -use crate::client::MockConnect; -use crate::{ - cli::Cli, - client::{fetching_with_report, Connect}, - git::{Repo, RepoActions}, - repo_ref::get_repo_coordinates, -}; - -#[derive(clap::Args)] -pub struct SubCommandArgs { - /// address pointer to repo announcement - #[arg(long, action)] - repo: Vec, -} - -pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { - let _ = args; - let git_repo = Repo::discover().context("cannot find a git repository")?; - #[cfg(not(test))] - let client = Client::default(); - #[cfg(test)] - let client = ::default(); - let repo_coordinates = if command_args.repo.is_empty() { - get_repo_coordinates(&git_repo, &client).await? - } else { - let mut repo_coordinates = HashSet::new(); - for repo in &command_args.repo { - repo_coordinates.insert(Coordinate::parse(repo.clone())?); - } - repo_coordinates - }; - fetching_with_report(git_repo.get_path()?, &client, &repo_coordinates).await?; - client.disconnect().await?; - Ok(()) -} -- cgit v1.2.3