Skip to content

Commit

Permalink
feat: add keep_repos config option; save cloned repos after installing
Browse files Browse the repository at this point in the history
  • Loading branch information
comfysage committed Jun 22, 2024
1 parent fe66fc1 commit e30ecb4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions saku-cli/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
3 changes: 3 additions & 0 deletions saku-lib/pkg/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ 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 {
pub fn default() -> Self {
Self {
frozen_update: false,
no_install_cleanup: false,
keep_repos: false,
}
}
}
Expand Down

0 comments on commit e30ecb4

Please sign in to comment.