From 43b5e9b38bf5dcfbac85637a2d3efc69ddfe77ac Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 4 Nov 2024 12:02:52 +0000 Subject: refactor: remove ngit `pull` `push` `fetch` simplify api to encougage use of the git plugin --- src/bin/ngit/sub_commands/fetch.rs | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 src/bin/ngit/sub_commands/fetch.rs (limited to 'src/bin/ngit/sub_commands/fetch.rs') diff --git a/src/bin/ngit/sub_commands/fetch.rs b/src/bin/ngit/sub_commands/fetch.rs deleted file mode 100644 index c69f1c5..0000000 --- a/src/bin/ngit/sub_commands/fetch.rs +++ /dev/null @@ -1,37 +0,0 @@ -use std::collections::HashSet; - -use anyhow::{Context, Result}; -use clap; -use nostr::nips::nip01::Coordinate; - -use crate::{ - cli::Cli, - client::{fetching_with_report, Client, 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")?; - let client = 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