Add zr support (#216)

This commit is contained in:
Jonathan Dahan
2019-09-05 02:37:42 -04:00
committed by Roey Darwish Dror
parent 8743236acb
commit 94c0102885
3 changed files with 23 additions and 0 deletions

View File

@@ -7,6 +7,22 @@ use std::env;
use std::path::{Path, PathBuf};
use std::process::Command;
pub fn run_zr(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> {
let zsh = require("zsh")?;
env::var("ZR_HOME")
.map(PathBuf::from)
.unwrap_or_else(|_| base_dirs.home_dir().join(".zr"))
.require()?;
print_separator("zr");
let zshrc = base_dirs.home_dir().join(".zshrc");
let cmd = format!("source {} && zr update", zshrc.display());
run_type.execute(zsh).args(&["-c", cmd.as_str()]).check_run()
}
pub fn run_zplug(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> {
let zsh = require("zsh")?;