mirror of
https://github.com/atuinsh/atuin.git
synced 2025-06-26 04:41:27 +02:00
fix: check session file exists for status command (#1756)
This commit is contained in:
parent
cf2cbd23f0
commit
05857c1c0e
@ -39,6 +39,7 @@ pub enum Cmd {
|
|||||||
base64: bool,
|
base64: bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/// Display the sync status
|
||||||
Status,
|
Status,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::{SHA, VERSION};
|
use crate::{SHA, VERSION};
|
||||||
use atuin_client::{api_client, database::Database, settings::Settings};
|
use atuin_client::{api_client, database::Database, settings::Settings};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use eyre::Result;
|
use eyre::Result;
|
||||||
|
|
||||||
pub async fn run(settings: &Settings, db: &impl Database) -> 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(
|
let client = api_client::Client::new(
|
||||||
&settings.sync_address,
|
&settings.sync_address,
|
||||||
&settings.session_token,
|
&settings.session_token,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user