automatically get DOTFILES_PATH

This commit is contained in:
Dmytro Meleshko 2018-11-10 16:51:47 +02:00
parent a523ed910d
commit 6fcb6b0750
4 changed files with 18 additions and 21 deletions

View File

@ -12,7 +12,6 @@ for zsh_file_name in z{shenv,shrc,login}; do
cat > "$zsh_file" <<EOF
#!/usr/bin/env zsh
export DOTFILES_PATH="$PWD"
source "\$DOTFILES_PATH/$zsh_file_name"
source "$PWD/$zsh_file_name"
EOF
done

6
zlogin
View File

@ -1,5 +1,5 @@
#!/usr/bin/env zsh
if [[ -n "$DOTFILES_PATH" ]]; then
python "$DOTFILES_PATH/welcome/main.py"
fi
DOTFILES_PATH="${0:h}"
python "$DOTFILES_PATH/welcome/main.py"

14
zshenv
View File

@ -1,10 +1,8 @@
#!/usr/bin/env zsh
if [[ -n "$DOTFILES_PATH" ]]; then
for script in functions path exports; do
source "$DOTFILES_PATH/lib/$script.zsh"
source_if_exists "$DOTFILES_PATH/custom/$script.zsh"
done
else
echo "please, set DOTFILES_PATH to the path to your dotfiles directory" >&2
fi
DOTFILES_PATH="${0:h}"
for script in functions path exports; do
source "$DOTFILES_PATH/lib/$script.zsh"
source_if_exists "$DOTFILES_PATH/custom/$script.zsh"
done

16
zshrc
View File

@ -1,11 +1,11 @@
#!/usr/bin/env zsh
if [[ -n "$DOTFILES_PATH" ]]; then
for script in oh-my-zsh aliases widgets theme; do
source "$DOTFILES_PATH/lib/$script.zsh"
source_if_exists "$DOTFILES_PATH/custom/$script.zsh"
done
DOTFILES_PATH="${0:h}"
run_before rbenv 'eval "$(rbenv init -)"'
run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"'
fi
for script in oh-my-zsh aliases widgets theme; do
source "$DOTFILES_PATH/lib/$script.zsh"
source_if_exists "$DOTFILES_PATH/custom/$script.zsh"
done
run_before rbenv 'eval "$(rbenv init -)"'
run_before sdk 'source_if_exists "$SDKMAN_DIR/bin/sdkman-init.sh"'