Add support to Zim (#545)

This commit is contained in:
Eric Nielsen
2020-10-24 14:46:38 -05:00
committed by GitHub
parent 3a34672ee5
commit 7783fc77ba
4 changed files with 23 additions and 8 deletions

View File

@@ -237,6 +237,7 @@ fn run() -> Result<()> {
runner.execute(Step::Shell, "antigen", || zsh::run_antigen(&base_dirs, run_type))?; runner.execute(Step::Shell, "antigen", || zsh::run_antigen(&base_dirs, run_type))?;
runner.execute(Step::Shell, "zplug", || zsh::run_zplug(&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, "zinit", || zsh::run_zinit(&base_dirs, run_type))?;
runner.execute(Step::Shell, "zim", || zsh::run_zim(&base_dirs, run_type))?;
runner.execute(Step::Shell, "oh-my-zsh", || zsh::run_oh_my_zsh(&ctx))?; runner.execute(Step::Shell, "oh-my-zsh", || zsh::run_oh_my_zsh(&ctx))?;
runner.execute(Step::Shell, "fisher", || unix::run_fisher(&base_dirs, run_type))?; runner.execute(Step::Shell, "fisher", || unix::run_fisher(&base_dirs, run_type))?;
runner.execute(Step::Shell, "oh-my-fish", || unix::run_oh_my_fish(&ctx))?; runner.execute(Step::Shell, "oh-my-fish", || unix::run_oh_my_fish(&ctx))?;

View File

@@ -111,10 +111,7 @@ impl Distribution {
} }
pub fn redhat_based(self) -> bool { pub fn redhat_based(self) -> bool {
match self { matches!(self, Distribution::CentOS | Distribution::Fedora)
Distribution::CentOS | Distribution::Fedora => true,
_ => false,
}
} }
} }

View File

@@ -20,10 +20,7 @@ enum BoxStatus {
impl BoxStatus { impl BoxStatus {
fn powered_on(self) -> bool { fn powered_on(self) -> bool {
match self { matches!(self, BoxStatus::Running)
BoxStatus::Running => true,
_ => false,
}
} }
} }

View File

@@ -80,6 +80,26 @@ pub fn run_zinit(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
run_type.execute(zsh).args(&["-i", "-c", cmd.as_str()]).check_run() run_type.execute(zsh).args(&["-i", "-c", cmd.as_str()]).check_run()
} }
pub fn run_zim(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
let zsh = require("zsh")?;
env::var("ZIM_HOME")
.or_else(|_| {
Command::new("zsh")
.args(&["-c", "[[ -n ${ZIM_HOME} ]] && print -n ${ZIM_HOME}"])
.check_output()
})
.map(PathBuf::from)
.unwrap_or_else(|_| base_dirs.home_dir().join(".zim"))
.require()?;
print_separator("zim");
run_type
.execute(zsh)
.args(&["-i", "-c", "zimfw upgrade && zimfw update"])
.check_run()
}
pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> { pub fn run_oh_my_zsh(ctx: &ExecutionContext) -> Result<()> {
require("zsh")?; require("zsh")?;
let oh_my_zsh = ctx.base_dirs().home_dir().join(".oh-my-zsh").require()?; let oh_my_zsh = ctx.base_dirs().home_dir().join(".oh-my-zsh").require()?;