src/exit.rs
15 lines · 325 bytes
1use home::home_dir;
2use std::{error::Error, fs};
3
4// exit tasks:
5// - remove `~/.cache`
6pub fn exit() -> Result<(), Box<dyn Error>> {
7 let home_dir = home_dir().unwrap();
8 let cache_path = home_dir.join(".cache/youtube-tui/");
9
10 if cache_path.exists() {
11 fs::remove_dir_all(cache_path)?;
12 }
13
14 Ok(())
15}