Skip to main content

git_psect/commands/
reset.rs

1use crate::{error::Error, repo};
2
3pub fn run() -> Result<(), Error> {
4    let ctx = repo::open()?;
5    let state_path = ctx.state_dir.join("state.toml");
6
7    if !state_path.exists() {
8        println!("No active session.");
9        return Ok(());
10    }
11
12    std::fs::remove_file(&state_path)?;
13
14    // Remove the directory if it's now empty.
15    let _ = std::fs::remove_dir(&ctx.state_dir);
16
17    println!("Session cleared.");
18    Ok(())
19}