Adding a new flag for cleaning up old resources (#90)
* Adding a new flag to topgrade called "cleanup" If you are using applications like homebrew they may keep a history of packages downloaded. Especially the bigger your number of installed packages for homebrew grows the bigger those directories get. This can quickly add up to a couple of GBs. If this flag is set then the homebrew part also calls "brew cleanup" for cleaning up old resources. Of course this can be add to other calls as well if supported. * Updating readme for new cleanup flag
This commit is contained in:
committed by
Roey Darwish Dror
parent
b370955f79
commit
7e5eb87b7d
@@ -52,13 +52,16 @@ pub fn run_fisher(base_dirs: &BaseDirs, terminal: &mut Terminal, dry_run: bool)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn run_homebrew(terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> {
|
||||
pub fn run_homebrew(terminal: &mut Terminal, cleanup: bool, dry_run: bool) -> Option<(&'static str, bool)> {
|
||||
if let Some(brew) = which("brew") {
|
||||
terminal.print_separator("Brew");
|
||||
|
||||
let inner = || -> Result<(), Error> {
|
||||
Executor::new(&brew, dry_run).arg("update").spawn()?.wait()?.check()?;
|
||||
Executor::new(&brew, dry_run).arg("upgrade").spawn()?.wait()?.check()?;
|
||||
if cleanup {
|
||||
Executor::new(&brew, dry_run).arg("cleanup").spawn()?.wait()?.check()?;
|
||||
}
|
||||
Ok(())
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user