dotenv.plugin.zsh 217 Bytes
Newer Older
Arthur's avatar
Arthur committed
1
2
3
4
#!/bin/zsh

source_env() {
  if [[ -f .env ]]; then
5
6
7
8
9
10
11
    if [[ -o a ]]; then
      source .env
    else
      set -a
      source .env
      set +a
    fi
Arthur's avatar
Arthur committed
12
13
14
15
16
  fi
}

autoload -U add-zsh-hook
add-zsh-hook chpwd source_env