diff --git a/saku-cli/src/install.rs b/saku-cli/src/install.rs index a04053b..4776404 100644 --- a/saku-cli/src/install.rs +++ b/saku-cli/src/install.rs @@ -48,5 +48,11 @@ pub fn install_pkg(p: Pkg) -> Result<()> { exec::cleanup(&p.name, &p.group)?; } + if !config.main.keep_repos { + let repo_path = path::repo(&p.name); + debug!("removing cloned repo: {repo_path}"); + std::fs::remove_dir_all(&repo_path)?; + } + Ok(()) } diff --git a/saku-lib/pkg/config.rs b/saku-lib/pkg/config.rs index 44d1a11..68d8aa6 100644 --- a/saku-lib/pkg/config.rs +++ b/saku-lib/pkg/config.rs @@ -11,6 +11,8 @@ pub struct ConfigMain { pub frozen_update: bool, // cleanup on `saku install` (default: false) pub no_install_cleanup: bool, + // keep repo after install (default: false) + pub keep_repos: bool, } impl ConfigMain { @@ -18,6 +20,7 @@ impl ConfigMain { Self { frozen_update: false, no_install_cleanup: false, + keep_repos: false, } } }