diff options
| author | Conrad Ludgate <conrad.ludgate@truelayer.com> | 2022-04-21 10:12:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-21 09:12:56 +0000 |
| commit | d57f549855caf8ab90b5ea0ae7cc9445f3abedfc (patch) | |
| tree | 0818ff405a3b697a0ca981d215ceb4dbb30cd15a /src/command/client/logout.rs | |
| parent | Fix SQL cache query (#318) (diff) | |
| download | atuin-d57f549855caf8ab90b5ea0ae7cc9445f3abedfc.zip | |
refactor commands for better separation (#313)
* refactor commands for better separation
* fmt
Diffstat (limited to 'src/command/client/logout.rs')
| -rw-r--r-- | src/command/client/logout.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/command/client/logout.rs b/src/command/client/logout.rs new file mode 100644 index 00000000..a7e9541d --- /dev/null +++ b/src/command/client/logout.rs @@ -0,0 +1,15 @@ +use eyre::{Context, Result}; +use fs_err::remove_file; + +pub fn run() -> Result<()> { + let session_path = atuin_common::utils::data_dir().join("session"); + + if session_path.exists() { + remove_file(session_path.as_path()).context("Failed to remove session file")?; + println!("You have logged out!"); + } else { + println!("You are not logged in"); + } + + Ok(()) +} |
