diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-04 12:02:52 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-04 12:02:52 +0000 |
| commit | 43b5e9b38bf5dcfbac85637a2d3efc69ddfe77ac (patch) | |
| tree | 28f0937414ec22921a73da08c38d93284bb50e41 /src/bin/ngit/sub_commands/fetch.rs | |
| parent | d62a6a4355d47de9babd6fc86fae2b240ff3ab28 (diff) | |
refactor: remove ngit `pull` `push` `fetch`
simplify api to encougage use of the git plugin
Diffstat (limited to 'src/bin/ngit/sub_commands/fetch.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/fetch.rs | 37 |
1 files changed, 0 insertions, 37 deletions
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 @@ | |||
| 1 | use std::collections::HashSet; | ||
| 2 | |||
| 3 | use anyhow::{Context, Result}; | ||
| 4 | use clap; | ||
| 5 | use nostr::nips::nip01::Coordinate; | ||
| 6 | |||
| 7 | use crate::{ | ||
| 8 | cli::Cli, | ||
| 9 | client::{fetching_with_report, Client, Connect}, | ||
| 10 | git::{Repo, RepoActions}, | ||
| 11 | repo_ref::get_repo_coordinates, | ||
| 12 | }; | ||
| 13 | |||
| 14 | #[derive(clap::Args)] | ||
| 15 | pub struct SubCommandArgs { | ||
| 16 | /// address pointer to repo announcement | ||
| 17 | #[arg(long, action)] | ||
| 18 | repo: Vec<String>, | ||
| 19 | } | ||
| 20 | |||
| 21 | pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { | ||
| 22 | let _ = args; | ||
| 23 | let git_repo = Repo::discover().context("cannot find a git repository")?; | ||
| 24 | let client = Client::default(); | ||
| 25 | let repo_coordinates = if command_args.repo.is_empty() { | ||
| 26 | get_repo_coordinates(&git_repo, &client).await? | ||
| 27 | } else { | ||
| 28 | let mut repo_coordinates = HashSet::new(); | ||
| 29 | for repo in &command_args.repo { | ||
| 30 | repo_coordinates.insert(Coordinate::parse(repo.clone())?); | ||
| 31 | } | ||
| 32 | repo_coordinates | ||
| 33 | }; | ||
| 34 | fetching_with_report(git_repo.get_path()?, &client, &repo_coordinates).await?; | ||
| 35 | client.disconnect().await?; | ||
| 36 | Ok(()) | ||
| 37 | } | ||