diff options
| author | Ellie Huxtable <ellie@atuin.sh> | 2025-03-19 12:44:20 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-19 12:44:20 +0000 |
| commit | 14ec768b4520d4fc34dbf24e663ea7db940c18b7 (patch) | |
| tree | a37db707ab8676cad5b3e6ca47af3f2997958906 /crates/atuin-client/src/api_client.rs | |
| parent | feat: Use readline binding for ctrl-a when it is not the prefix (#2626) (diff) | |
| download | atuin-14ec768b4520d4fc34dbf24e663ea7db940c18b7.zip | |
chore: migrate to rust 2024 (#2635)
* chore: upgrade to 2024 edition
* ugh unsafe
* format
* nixxxxxxxxxxx why
Diffstat (limited to 'crates/atuin-client/src/api_client.rs')
| -rw-r--r-- | crates/atuin-client/src/api_client.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/crates/atuin-client/src/api_client.rs b/crates/atuin-client/src/api_client.rs index 19820b29..0bd16c50 100644 --- a/crates/atuin-client/src/api_client.rs +++ b/crates/atuin-client/src/api_client.rs @@ -2,13 +2,17 @@ use std::collections::HashMap; use std::env; use std::time::Duration; -use eyre::{bail, Result}; +use eyre::{Result, bail}; use reqwest::{ - header::{HeaderMap, AUTHORIZATION, USER_AGENT}, Response, StatusCode, Url, + header::{AUTHORIZATION, HeaderMap, USER_AGENT}, }; use atuin_common::{ + api::{ATUIN_CARGO_VERSION, ATUIN_HEADER_VERSION, ATUIN_VERSION}, + record::{EncryptedData, HostId, Record, RecordIdx}, +}; +use atuin_common::{ api::{ AddHistoryRequest, ChangePasswordRequest, CountResponse, DeleteHistoryRequest, ErrorResponse, LoginRequest, LoginResponse, MeResponse, RegisterResponse, @@ -17,14 +21,10 @@ use atuin_common::{ }, record::RecordStatus, }; -use atuin_common::{ - api::{ATUIN_CARGO_VERSION, ATUIN_HEADER_VERSION, ATUIN_VERSION}, - record::{EncryptedData, HostId, Record, RecordIdx}, -}; use semver::Version; -use time::format_description::well_known::Rfc3339; use time::OffsetDateTime; +use time::format_description::well_known::Rfc3339; use crate::{history::History, sync::hash_str, utils::get_host_user}; @@ -126,7 +126,9 @@ pub fn ensure_version(response: &Response) -> Result<bool> { // If the client is newer than the server if version.major < ATUIN_VERSION.major { - println!("Atuin version mismatch! In order to successfully sync, the server needs to run a newer version of Atuin"); + println!( + "Atuin version mismatch! In order to successfully sync, the server needs to run a newer version of Atuin" + ); println!("Client: {}", ATUIN_CARGO_VERSION); println!("Server: {}", version); @@ -157,10 +159,14 @@ async fn handle_resp_error(resp: Response) -> Result<Response> { bail!("Invalid request to the service: {status} - {reason}.") } - bail!("There was an error with the atuin sync service, server error {status}: {reason}.\nIf the problem persists, contact the host") + bail!( + "There was an error with the atuin sync service, server error {status}: {reason}.\nIf the problem persists, contact the host" + ) } - bail!("There was an error with the atuin sync service: Status {status:?}.\nIf the problem persists, contact the host") + bail!( + "There was an error with the atuin sync service: Status {status:?}.\nIf the problem persists, contact the host" + ) } Ok(resp) |
