use super::super::ct_fs::default_path;
use super::errors;
use super::persistent;
use super::project_path;
use glob::glob;
use std::path::PathBuf;
pub fn all(_print_progress: bool) -> errors::CtResult<()> {
let time_path = default_path::time_path()?;
let paths: Vec<PathBuf> = glob(format!("{}/*.json", time_path.to_str().unwrap()).as_str())
.unwrap()
.filter(|p| match p {
Ok(_) => true,
Err(e) => {
bunt::eprintln!("{$red}GlobError: {:?}{/$}", e);
false
}
})
.map(|p| p.unwrap())
.collect();
for p in paths {
std::fs::remove_file(p)?;
}
persistent::clear_store()?;
Ok(())
}
pub fn named(name: &str) -> errors::CtResult<()> {
std::fs::remove_file(project_path(name)?)?;
persistent::delete_stored_if(name)?;
Ok(())
}