diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2024-02-22 18:53:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-22 18:53:51 +0000 |
commit | 05857c1c0e0083309268df7d9fcbbb6daccf9487 (patch) | |
tree | 4f1667fee00325441110c5fdbb329b568ed6e671 | |
parent | cf2cbd23f03286e8e7d12f47fec1023dd119106c (diff) |
fix: check session file exists for status command (#1756)
-rw-r--r-- | atuin/src/command/client/sync.rs | 1 | ||||
-rw-r--r-- | atuin/src/command/client/sync/status.rs | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/atuin/src/command/client/sync.rs b/atuin/src/command/client/sync.rs index 67840ced..03735eb5 100644 --- a/atuin/src/command/client/sync.rs +++ b/atuin/src/command/client/sync.rs @@ -39,6 +39,7 @@ pub enum Cmd { base64: bool, }, + /// Display the sync status Status, } diff --git a/atuin/src/command/client/sync/status.rs b/atuin/src/command/client/sync/status.rs index a03ebb4c..b7b63c22 100644 --- a/atuin/src/command/client/sync/status.rs +++ b/atuin/src/command/client/sync/status.rs @@ -1,9 +1,19 @@ +use std::path::PathBuf; + use crate::{SHA, VERSION}; use atuin_client::{api_client, database::Database, settings::Settings}; use colored::Colorize; use eyre::Result; pub async fn run(settings: &Settings, db: &impl Database) -> Result<()> { + let session_path = settings.session_path.as_str(); + + if !PathBuf::from(session_path).exists() { + println!("You are not logged in to a sync server - cannot show sync status"); + + return Ok(()); + } + let client = api_client::Client::new( &settings.sync_address, &settings.session_token, |