diff options
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 dc548fd..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("failed to 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 | } | ||