Add cache cleaning #13

Merged
luke merged 4 commits from development into main 2024-04-30 21:50:31 +00:00
2 changed files with 12 additions and 0 deletions
Showing only changes of commit 9d264ecbf4 - Show all commits

View File

@ -87,6 +87,12 @@ pub fn remove_unused(packages: Vec<String>) -> Result<()> {
check_exit_code(exit_status)
}
pub fn clean_cache() -> Result<()> {
let exit_status = shell_commands::execute_in_sh("sudo pacman -Scc")?;
check_exit_code(exit_status)
}
fn check_exit_code(exit_status: ExitStatus) -> Result<()> {
if !exit_status.success() {
let exit_code = match exit_status.code() {

View File

@ -50,6 +50,12 @@ fn main() {
return;
}
notice_println("Clearing Cache");
if let Err(e) = pacman::clean_cache() {
error_println(e.to_string());
return;
}
notice_println("\nUpdate process complete!");
}