Uber refactor
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user