aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/client/sync/logout.rs
blob: 90b49d6db6f44232c4e883f0aee020ad49bdb38e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::path::PathBuf;

use eyre::{Context, Result};
use fs_err::remove_file;

use atuin_client::settings::Settings;

pub fn run(settings: &Settings) -> Result<()> {
    let session_path = settings.session_path.as_str();

    if PathBuf::from(session_path).exists() {
        remove_file(session_path).context("Failed to remove session file")?;
        println!("You have logged out!");
    } else {
        println!("You are not logged in");
    }

    Ok(())
}