Use args instead of arg. Don't cleanup brew

This commit is contained in:
Roey Darwish Dror
2018-06-03 17:16:54 +03:00
parent 4a208d9e8c
commit ffc3af4e79

View File

@@ -99,8 +99,7 @@ fn run() -> Result<()> {
terminal.print_separator("zplug"); terminal.print_separator("zplug");
if home_path(".zplug").exists() { if home_path(".zplug").exists() {
Command::new(&zsh) Command::new(&zsh)
.arg("-c") .args(&["-c", "source ~/.zshrc && zplug update"])
.arg("source ~/.zshrc && zplug update")
.spawn()? .spawn()?
.wait()?; .wait()?;
} }
@@ -116,8 +115,7 @@ fn run() -> Result<()> {
if cargo_upgrade.exists() { if cargo_upgrade.exists() {
terminal.print_separator("Cargo"); terminal.print_separator("Cargo");
Command::new(&cargo_upgrade) Command::new(&cargo_upgrade)
.arg("install-update") .args(&["install-update", "--all"])
.arg("--all")
.spawn()? .spawn()?
.wait()?; .wait()?;
} }
@@ -126,11 +124,13 @@ fn run() -> Result<()> {
if home_path(".emacs.d").exists() { if home_path(".emacs.d").exists() {
terminal.print_separator("Emacs"); terminal.print_separator("Emacs");
Command::new(&emacs) Command::new(&emacs)
.arg("--batch") .args(&[
.arg("-l") "--batch",
.arg(home_path(".emacs.d/init.el")) "-l",
.arg("--eval") home_path(".emacs.d/init.el").to_str().unwrap(),
.arg(EMACS_UPGRADE) "--eval",
EMACS_UPGRADE,
])
.spawn()? .spawn()?
.wait()?; .wait()?;
} }
@@ -147,8 +147,7 @@ fn run() -> Result<()> {
} else { } else {
if let Ok(sudo) = &sudo { if let Ok(sudo) = &sudo {
Command::new(&sudo) Command::new(&sudo)
.arg("pacman") .args(&["pacman", "-Syu"])
.arg("-Syu")
.spawn()? .spawn()?
.wait()?; .wait()?;
} else { } else {
@@ -160,8 +159,7 @@ fn run() -> Result<()> {
OSType::CentOS | OSType::Redhat => { OSType::CentOS | OSType::Redhat => {
if let Ok(sudo) = &sudo { if let Ok(sudo) = &sudo {
Command::new(&sudo) Command::new(&sudo)
.arg("yum") .args(&["yum", "upgrade"])
.arg("upgrade")
.spawn()? .spawn()?
.wait()?; .wait()?;
} }
@@ -170,15 +168,13 @@ fn run() -> Result<()> {
OSType::Ubuntu | OSType::Debian => { OSType::Ubuntu | OSType::Debian => {
if let Ok(sudo) = &sudo { if let Ok(sudo) = &sudo {
Command::new(&sudo) Command::new(&sudo)
.arg("apt") .args(&["apt", "update"])
.arg("update")
.spawn()? .spawn()?
.wait()? .wait()?
.check() .check()
.and_then(|()| { .and_then(|()| {
Command::new(&sudo) Command::new(&sudo)
.arg("apt") .args(&["apt", "dist-upgrade"])
.arg("dist-upgrade")
.spawn()? .spawn()?
.wait() .wait()
.map_err(|e| e.into()) .map_err(|e| e.into())
@@ -227,11 +223,9 @@ fn run() -> Result<()> {
.spawn()? .spawn()?
.wait()? .wait()?
.check() .check()
.and_then(|()| Command::new(&brew).arg("upgrade").spawn()?.wait()?.check())
.and_then(|()| { .and_then(|()| {
Command::new(&brew) Command::new(&brew)
.arg("cleanup") .arg("upgrade")
.arg("-sbr")
.spawn()? .spawn()?
.wait() .wait()
.map_err(|e| e.into()) .map_err(|e| e.into())
@@ -240,8 +234,7 @@ fn run() -> Result<()> {
terminal.print_separator("System update"); terminal.print_separator("System update");
Command::new("softwareupdate") Command::new("softwareupdate")
.arg("--install") .args(&["--install", "--all"])
.arg("--all")
.spawn()? .spawn()?
.wait()?; .wait()?;
} }