diff --git a/Cargo.lock b/Cargo.lock index 24d13c54..b21e8268 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1845,7 +1845,7 @@ dependencies = [ [[package]] name = "topgrade" -version = "4.0.1" +version = "4.0.2" dependencies = [ "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 8327f296..a305b6ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ categories = ["os"] keywords = ["upgrade", "update"] license-file = "LICENSE" repository = "https://github.com/r-darwish/topgrade" -version = "4.0.1" +version = "4.0.2" authors = ["Roey Darwish Dror "] exclude = ["doc/screenshot.gif"] edition = "2018" diff --git a/src/steps/zsh.rs b/src/steps/zsh.rs index 3c0e1de0..cf94faa8 100644 --- a/src/steps/zsh.rs +++ b/src/steps/zsh.rs @@ -1,4 +1,3 @@ -use crate::error::SkipStep; use crate::executor::RunType; use crate::terminal::print_separator; use crate::utils::{require, PathExt}; @@ -69,33 +68,14 @@ pub fn run_zinit(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> { let zsh = require("zsh")?; let zshrc = zshrc(base_dirs).require()?; - let zinit_exists = env::var("ZPFX") + env::var("ZPFX") .map(PathBuf::from) .unwrap_or_else(|_| base_dirs.home_dir().join(".zinit")) - .exists(); - - let zplugin_exists = env::var("ZPLUG_HOME") - .map(PathBuf::from) - .unwrap_or_else(|_| base_dirs.home_dir().join(".zplugin")) - .exists(); - - // Check whether this is a pre- or post- renaming installation - let zcommand = if zinit_exists { - "zinit" - } else if zplugin_exists { - "zplugin" - } else { - return Err(SkipStep.into()); - }; + .require()?; print_separator("zinit"); - let cmd = format!( - "source {} && {} self-update && {} update --all", - zshrc.display(), - zcommand, - zcommand - ); + let cmd = format!("source {} && zinit self-update && zinit update --all", zshrc.display(),); run_type.execute(zsh).args(&["-l", "-c", cmd.as_str()]).check_run() }