Skip to content

Commit

Permalink
fix: check session file exists for status command (#1756)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellie committed Feb 22, 2024
1 parent cf2cbd2 commit 05857c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions atuin/src/command/client/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub enum Cmd {
base64: bool,
},

/// Display the sync status
Status,
}

Expand Down
10 changes: 10 additions & 0 deletions atuin/src/command/client/sync/status.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit 05857c1

Please sign in to comment.