Add zgenom zsh plugin manager (#862)

- add the required functionality for zgenom
 - fix the env::var for zinit - it should be ZINIT_HOME, not ZBXF, as
   this is also set in zgenom, but makes topgrade fail when zinit is not
   installed

Co-authored-by: Sven Hergenhahn <sven.hergenhahn@dm.de>
This commit is contained in:
Sven Hergenhahn 2022-02-18 15:01:34 +01:00 committed by Roey Darwish Dror
parent cea32020ce
commit afa3171d99
2 changed files with 16 additions and 1 deletions

View File

@ -257,6 +257,7 @@ fn run() -> Result<()> {
runner.execute(Step::Shell, "zr", || zsh::run_zr(&base_dirs, run_type))?;
runner.execute(Step::Shell, "antibody", || zsh::run_antibody(run_type))?;
runner.execute(Step::Shell, "antigen", || zsh::run_antigen(&base_dirs, run_type))?;
runner.execute(Step::Shell, "zgenom", || zsh::run_zgenom(&base_dirs, run_type))?;
runner.execute(Step::Shell, "zplug", || zsh::run_zplug(&base_dirs, run_type))?;
runner.execute(Step::Shell, "zinit", || zsh::run_zinit(&base_dirs, run_type))?;
runner.execute(Step::Shell, "zim", || zsh::run_zim(&base_dirs, run_type))?;

View File

@ -51,6 +51,20 @@ pub fn run_antigen(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
run_type.execute(zsh).args(&["-l", "-c", cmd.as_str()]).check_run()
}
pub fn run_zgenom(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
let zsh = require("zsh")?;
let zshrc = zshrc(base_dirs).require()?;
env::var("ZGEN_SOURCE")
.map(PathBuf::from)
.unwrap_or_else(|_| base_dirs.home_dir().join(".zgenom"))
.require()?;
print_separator("zgenom");
let cmd = format!("source {} && zgenom selfupdate && zgenom update", zshrc.display());
run_type.execute(zsh).args(&["-l", "-c", cmd.as_str()]).check_run()
}
pub fn run_zplug(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
let zsh = require("zsh")?;
zshrc(base_dirs).require()?;
@ -69,7 +83,7 @@ pub fn run_zinit(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
let zsh = require("zsh")?;
let zshrc = zshrc(base_dirs).require()?;
env::var("ZPFX")
env::var("ZINIT_HOME")
.map(PathBuf::from)
.unwrap_or_else(|_| base_dirs.home_dir().join(".zinit"))
.require()?;