From e30ecb4b09beddfcf53453a2b63231ec750e74c3 Mon Sep 17 00:00:00 2001 From: comfysage <67917529+comfysage@users.noreply.github.com> Date: Sat, 22 Jun 2024 15:55:56 +0200 Subject: [PATCH] feat: add `keep_repos` config option; save cloned repos after installing --- saku-cli/src/install.rs | 6 ++++++ saku-lib/pkg/config.rs | 3 +++ 2 files changed, 9 insertions(+) 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, } } }