Implement Scoop (fix #78)

This commit is contained in:
Roey Darwish Dror
2018-10-17 13:57:30 +03:00
parent e5489270df
commit 0b03e1f9d1
2 changed files with 31 additions and 0 deletions

View File

@@ -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),

View File

@@ -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<PathBuf>,
}