mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2024-11-22 07:20:59 +02:00
Handle missing $1 in _autoenv_hash_pair
This commit is contained in:
parent
4ed8aa2be3
commit
4cdad1d4d5
@ -122,12 +122,18 @@ _autoenv_debug() {
|
||||
zmodload -F zsh/stat b:zstat
|
||||
|
||||
|
||||
# Generate hash pair for a given file ($1).
|
||||
# A fixed hash value can be given as 2nd arg, but is used with tests only.
|
||||
_autoenv_hash_pair() {
|
||||
local env_file=${1:A}
|
||||
local env_shasum
|
||||
if [[ -n $2 ]]; then
|
||||
env_shasum=$2
|
||||
else
|
||||
if ! [[ -e $env_file ]]; then
|
||||
echo "Missing file argument for _autoenv_hash_pair!" >&2
|
||||
return 1
|
||||
fi
|
||||
env_shasum=$(shasum $env_file | cut -d' ' -f1)
|
||||
fi
|
||||
echo "$env_file:$env_shasum:1"
|
||||
|
Loading…
Reference in New Issue
Block a user