fix: check session file exists for status command (#1756)

This commit is contained in:
Ellie Huxtable 2024-02-22 18:53:51 +00:00 committed by GitHub
parent cf2cbd23f0
commit 05857c1c0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -39,6 +39,7 @@ pub enum Cmd {
base64: bool,
},
/// Display the sync status
Status,
}

View File

@ -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,