aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--atuin/src/command/client/account/delete.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/atuin/src/command/client/account/delete.rs b/atuin/src/command/client/account/delete.rs
index 5208a077..6a4b1406 100644
--- a/atuin/src/command/client/account/delete.rs
+++ b/atuin/src/command/client/account/delete.rs
@@ -1,9 +1,11 @@
use atuin_client::{api_client, settings::Settings};
use eyre::{bail, Result};
+use std::fs::remove_file;
use std::path::PathBuf;
pub async fn run(settings: &Settings) -> Result<()> {
let session_path = settings.session_path.as_str();
+ let key_path = settings.key_path.as_str();
if !PathBuf::from(session_path).exists() {
bail!("You are not logged in");
@@ -18,6 +20,15 @@ pub async fn run(settings: &Settings) -> Result<()> {
client.delete().await?;
+ // Fixes stale session+key when account is deleted via CLI.
+ if PathBuf::from(session_path).exists() {
+ remove_file(PathBuf::from(session_path))?;
+ }
+
+ if PathBuf::from(key_path).exists() {
+ remove_file(PathBuf::from(key_path))?;
+ }
+
println!("Your account is deleted");
Ok(())