Add cache cleaning #13
@ -87,6 +87,12 @@ pub fn remove_unused(packages: Vec<String>) -> Result<()> {
|
|||||||
check_exit_code(exit_status)
|
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<()> {
|
fn check_exit_code(exit_status: ExitStatus) -> Result<()> {
|
||||||
if !exit_status.success() {
|
if !exit_status.success() {
|
||||||
let exit_code = match exit_status.code() {
|
let exit_code = match exit_status.code() {
|
||||||
|
@ -50,6 +50,12 @@ fn main() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notice_println("Clearing Cache");
|
||||||
|
if let Err(e) = pacman::clean_cache() {
|
||||||
|
error_println(e.to_string());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
notice_println("\nUpdate process complete!");
|
notice_println("\nUpdate process complete!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user