diff --git a/src/main.rs b/src/main.rs index dd9c635b..6a47c33c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -175,6 +175,12 @@ fn run() -> Result<(), Error> { &mut execution_context, )?); + #[cfg(windows)] + report.push_result(execute( + |terminal| windows::run_scoop(terminal, opt.dry_run), + &mut execution_context, + )?); + #[cfg(unix)] report.push_result(execute( |terminal| unix::run_homebrew(terminal, opt.dry_run), diff --git a/src/windows.rs b/src/windows.rs index 4a7d9041..4dd7e32e 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -25,6 +25,31 @@ pub fn run_chocolatey(terminal: &mut Terminal, dry_run: bool) -> Option<(&'stati None } +#[must_use] +pub fn run_scoop(terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> { + if let Some(scoop) = utils::which("scoop") { + terminal.print_separator("Scoop"); + + let success = || -> Result<(), failure::Error> { + Executor::new(&scoop, dry_run) + .args(&["update"]) + .spawn()? + .wait()? + .check()?; + Executor::new(&scoop, dry_run) + .args(&["update", "*"]) + .spawn()? + .wait()? + .check()?; + Ok(()) + }().is_ok(); + + return Some(("Scoop", success)); + } + + None +} + pub struct Powershell { path: Option, }