Uber refactor

This commit is contained in:
Roey Darwish Dror
2018-08-19 14:45:23 +03:00
parent 8ae5065167
commit 473f361fca
12 changed files with 434 additions and 340 deletions

View File

@@ -1,10 +1,20 @@
use super::utils::Check;
use super::terminal::Terminal;
use super::utils::{self, Check};
use failure;
use std::path::PathBuf;
use std::process::Command;
pub fn run_chocolatey(choco: &PathBuf) -> Result<(), failure::Error> {
Command::new(&choco).args(&["upgrade", "all"]).spawn()?.wait()?.check()?;
#[must_use]
pub fn run_chocolatey(terminal: &mut Terminal) -> Option<(&'static str, bool)> {
if let Some(choco) = utils::which("choco") {
terminal.print_separator("Chocolatey");
Ok(())
let success = || -> Result<(), failure::Error> {
Command::new(&choco).args(&["upgrade", "all"]).spawn()?.wait()?.check()?;
Ok(())
}().is_ok();
return Some(("Chocolatey", success));
}
None
}