Add cache cleaning #13
@ -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() {
|
||||
|
@ -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!");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user