diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-17 10:53:20 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-17 10:53:20 +0100 |
| commit | 43a445963968dac7da190b56f7c89ac0ff1f6abd (patch) | |
| tree | 3c58f17c53de3f6ccc888323d677da12402a7891 /src/sub_commands/fetch.rs | |
| parent | 65d5daf6e42683ef116369b4f6a0f99d6971667b (diff) | |
feat(login): use fetch to get user profile
fetch automatically gets updates to logged in user profile / relays
fetching without specifying repo pointers will just fetch user
profiles so that can be used during login, if user profile isn't
in cache
login now uses fetch
Diffstat (limited to 'src/sub_commands/fetch.rs')
| -rw-r--r-- | src/sub_commands/fetch.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sub_commands/fetch.rs b/src/sub_commands/fetch.rs index 07fd6f9..5a6850c 100644 --- a/src/sub_commands/fetch.rs +++ b/src/sub_commands/fetch.rs | |||
| @@ -9,7 +9,7 @@ use crate::client::Client; | |||
| 9 | #[cfg(test)] | 9 | #[cfg(test)] |
| 10 | use crate::client::MockConnect; | 10 | use crate::client::MockConnect; |
| 11 | use crate::{ | 11 | use crate::{ |
| 12 | client::Connect, | 12 | client::{consolidate_fetch_reports, Connect}, |
| 13 | git::{Repo, RepoActions}, | 13 | git::{Repo, RepoActions}, |
| 14 | repo_ref::get_repo_coordinates, | 14 | repo_ref::get_repo_coordinates, |
| 15 | Cli, | 15 | Cli, |
| @@ -38,9 +38,16 @@ pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> { | |||
| 38 | } | 38 | } |
| 39 | repo_coordinates | 39 | repo_coordinates |
| 40 | }; | 40 | }; |
| 41 | client | 41 | println!("fetching updates..."); |
| 42 | let (relay_reports, _) = client | ||
| 42 | .fetch_all(git_repo.get_path()?, &repo_coordinates) | 43 | .fetch_all(git_repo.get_path()?, &repo_coordinates) |
| 43 | .await?; | 44 | .await?; |
| 45 | let report = consolidate_fetch_reports(relay_reports); | ||
| 46 | if report.to_string().is_empty() { | ||
| 47 | println!("no updates"); | ||
| 48 | } else { | ||
| 49 | println!("updates: {report}"); | ||
| 50 | } | ||
| 44 | client.disconnect().await?; | 51 | client.disconnect().await?; |
| 45 | Ok(()) | 52 | Ok(()) |
| 46 | } | 53 | } |