1
0
mirror of https://github.com/Tarrasch/zsh-autoenv.git synced 2025-12-14 02:15:11 +02:00

Optimize _autoenv_authorized_env_file

This uses Zsh directly, instead of calling grep potentially twice for a
missing entry.
This commit is contained in:
Daniel Hahler
2017-12-16 00:54:54 +01:00
committed by Daniel Hahler
parent 1d15e0d1a9
commit 12ed110764
2 changed files with 30 additions and 16 deletions

View File

@@ -29,9 +29,10 @@ fi
# Add file ($1), version ($2), and optional hash ($3) to authentication file.
test_autoenv_add_to_env() {
[[ -d ${AUTOENV_AUTH_FILE:h} ]] || mkdir -p ${AUTOENV_AUTH_FILE:h}
_autoenv_deauthorize $1
{
local ret_pair
_autoenv_hash_pair $1 1 ${2:-} && echo $ret_pair
_autoenv_hash_pair $1 2 ${2:-} && echo $ret_pair
} >>| $AUTOENV_AUTH_FILE
}