From 7512827a65ea2a8f764f0bf03e7fb01e200bcec2 Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Tue, 2 Aug 2022 20:39:11 -0600 Subject: [PATCH] Actually correctly check for commands before using them --- dotfiles/.zprofile | 8 +++++--- dotfiles/.zshrc | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/dotfiles/.zprofile b/dotfiles/.zprofile index 002cac7..fd004ca 100644 --- a/dotfiles/.zprofile +++ b/dotfiles/.zprofile @@ -11,7 +11,9 @@ fi #export GTK_USE_PORTAL=1 # Try to use native file pickers in GTK programs #---------------------------------------------------------------------------------# ### Load pyenv -export PYENV_ROOT="$HOME/.pyenv" -export PATH="$PYENV_ROOT/bin:$PATH" -eval "$(pyenv init --path)" +if command -v pyenv &> /dev/null; then + export PYENV_ROOT="$HOME/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + eval "$(pyenv init -)" +fi #---------------------------------------------------------------------------------# diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc index bf75f04..807eb78 100644 --- a/dotfiles/.zshrc +++ b/dotfiles/.zshrc @@ -7,8 +7,10 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi #---------------------------------------------------------------------------------# -### Load nvm (node version manager) -source /usr/share/nvm/init-nvm.sh +### Load nvm if script is in aur location +if [[ ! -f /usr/share/nvm/init-nvm.sh ]]; then + source /usr/share/nvm/init-nvm.sh +fi #---------------------------------------------------------------------------------# ### Add things to PATH path+=("$HOME/.pyenv/bin") @@ -31,6 +33,8 @@ bindkey -e #---------------------------------------------------------------------------------# ### Load pyenv if command -v pyenv &> /dev/null; then + export PYENV_ROOT="$HOME/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" fi #---------------------------------------------------------------------------------#