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

@@ -74,6 +74,7 @@ Just run `topgrade`. It will run the following steps:
* ~/.config/i3
* Powershell Profile
* Custom defined paths
* **Unix**: Run [zr](https://github.com/jedahan/zr) update
* **Unix**: Run [zplug](https://github.com/zplug/zplug) update
* **Unix**: Run [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) update
* **Unix**: Run [fisher](https://github.com/jorgebucaran/fisher)

View File

@@ -260,6 +260,12 @@ fn run() -> Result<(), Error> {
#[cfg(unix)]
{
execute(
&mut report,
"zr",
|| unix::run_zr(&base_dirs, run_type),
config.no_retry(),
)?;
execute(
&mut report,
"zplug",

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")?;