1
0
mirror of https://github.com/Tarrasch/zsh-autoenv.git synced 2024-11-22 15:30:59 +02:00

Use 'local' in functions

This commit is contained in:
Daniel Hahler 2014-11-15 14:49:48 +01:00
parent 1e60c98e4a
commit 41625bf31c

View File

@ -4,26 +4,26 @@
export ENV_AUTHORIZATION_FILE=$HOME/.env_auth export ENV_AUTHORIZATION_FILE=$HOME/.env_auth
_dotenv_hash_pair() { _dotenv_hash_pair() {
env_file=$1 local env_file=$1
env_shasum=$(shasum $env_file | cut -d' ' -f1) env_shasum=$(shasum $env_file | cut -d' ' -f1)
echo "$env_file:$env_shasum" echo "$env_file:$env_shasum"
} }
_dotenv_authorized_env_file() { _dotenv_authorized_env_file() {
env_file=$1 local env_file=$1
pair=$(_dotenv_hash_pair $env_file) local pair=$(_dotenv_hash_pair $env_file)
touch $ENV_AUTHORIZATION_FILE touch $ENV_AUTHORIZATION_FILE
\grep -Gq $pair $ENV_AUTHORIZATION_FILE \grep -Gq $pair $ENV_AUTHORIZATION_FILE
} }
_dotenv_authorize() { _dotenv_authorize() {
env_file=$1 local env_file=$1
_dotenv_deauthorize $env_file _dotenv_deauthorize $env_file
_dotenv_hash_pair $env_file >> $ENV_AUTHORIZATION_FILE _dotenv_hash_pair $env_file >> $ENV_AUTHORIZATION_FILE
} }
_dotenv_deauthorize() { _dotenv_deauthorize() {
env_file=$1 local env_file=$1
echo $(\grep -Gv $env_file $ENV_AUTHORIZATION_FILE) > $ENV_AUTHORIZATION_FILE echo $(\grep -Gv $env_file $ENV_AUTHORIZATION_FILE) > $ENV_AUTHORIZATION_FILE
} }