diff --git a/src/main.rs b/src/main.rs index 78425c12..720298a8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -299,7 +299,7 @@ fn run() -> Result<()> { runner.execute(Step::Shell, "zi", || zsh::run_zi(&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, "fisher", || unix::run_fisher(&base_dirs, run_type))?; + runner.execute(Step::Shell, "fisher", || unix::run_fisher(run_type))?; runner.execute(Step::Shell, "bash-it", || unix::run_bashit(&ctx))?; runner.execute(Step::Shell, "oh-my-fish", || unix::run_oh_my_fish(&ctx))?; runner.execute(Step::Shell, "fish-plug", || unix::run_fish_plug(&ctx))?; diff --git a/src/steps/os/unix.rs b/src/steps/os/unix.rs index 3f2c6811..2a73def7 100644 --- a/src/steps/os/unix.rs +++ b/src/steps/os/unix.rs @@ -87,15 +87,20 @@ impl BrewVariant { } } -pub fn run_fisher(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> { +pub fn run_fisher(run_type: RunType) -> Result<()> { let fish = require("fish")?; - if env::var("fisher_path").is_err() { - base_dirs - .home_dir() - .join(".config/fish/functions/fisher.fish") - .require()?; - } + Command::new(&fish) + .args(["-c", "type -t fisher"]) + .output_checked_utf8() + .map(|_| ()) + .map_err(|_| SkipStep("`fisher` is not defined in `fish`".to_owned()))?; + + Command::new(&fish) + .args(["-c", "echo \"$__fish_config_dir/fish_plugins\""]) + .output_checked_utf8() + .and_then(|output| Path::new(&output.stdout.trim()).require().map(|_| ())) + .map_err(|err| SkipStep(format!("`fish_plugins` path doesn't exist: {err}")))?; print_separator("Fisher");