mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 08:24:11 -06:00
refactor: simplify homebrew shellenv init without brittle caching
This commit is contained in:
@@ -45,20 +45,9 @@ else if test -f $HOME/.cargo/env
|
||||
set -a paths_to_add $CARGO_HOME/bin
|
||||
end
|
||||
|
||||
# Homebrew (cached for performance - reduces startup time by ~14ms)
|
||||
# Homebrew
|
||||
if test -f /home/linuxbrew/.linuxbrew/bin/brew
|
||||
set -l brew_cache "$HOME/.cache/brew_env.fish"
|
||||
set -l brew_bin "/home/linuxbrew/.linuxbrew/bin/brew"
|
||||
|
||||
# Regenerate cache if: doesn't exist, >7 days old, or brew binary is newer
|
||||
if not test -f "$brew_cache"; \
|
||||
or test (math (date +%s) - (stat -c %Y "$brew_cache" 2>/dev/null || echo 0)) -gt 604800; \
|
||||
or test (stat -c %Y "$brew_bin" 2>/dev/null || echo 0) -gt (stat -c %Y "$brew_cache" 2>/dev/null || echo 0)
|
||||
mkdir -p (dirname "$brew_cache")
|
||||
$brew_bin shellenv > "$brew_cache" 2>/dev/null
|
||||
end
|
||||
|
||||
test -f "$brew_cache" && source "$brew_cache"
|
||||
/home/linuxbrew/.linuxbrew/bin/brew shellenv fish | source
|
||||
end
|
||||
|
||||
set -gx PYENV_ROOT $HOME/.pyenv
|
||||
|
||||
Reference in New Issue
Block a user