This uses `emulate -L zsh` (as a more broad approach to `setopt
localtoptions noshwordsplit`, or quoting things) in the entry points to
zsh-autoenv.
Fixes https://github.com/Tarrasch/zsh-autoenv/issues/75
This prevents issues where autoenv scripts use $0. When a shell enters the directory holding the autoenv scripts, it works as expected with $0 being the path to the symlink. However, if the shell enters one of its child directories the path to the script is dereferenced, and $0 is instead the path to the symlink's target.
From `man 1 zshexpn`:
> A – Turn a file name into an absolute path as the 'a' modifier does, and then pass the result through the realpath(3) library function to resolve symbolic links.
Note: Symlinks are dereferenced elsewhere for authorization, so that behavior is unchanged.
A new parameter is added to `_autoenv_hash_pair` to specify the version, defaulting to the latest (2). It outputs a `cksum`-based hash for version 2 and `shasum`-based for version 1.
Moves logic to check for an entry in `$AUTOENV_AUTH_FILE` into its own function (`_autoenv_authorized_pair`), as it may need to be called twice.
Modifies `_autoenv_authorized_env_file` to check for v1 entries when v2 fails.
Fixes#53. Alternative implementation to #54.
This changes the defaults:
- AUTOENV_FILE_ENTER: .env => .autoenv.zsh
- AUTOENV_FILE_LEAVE: .env_leave => .autoenv_leave.zsh
`.env` is usually used only for key-value pairs for environment
settings, e.g. with foreman. We do not want to interfere with this.
This also renames the setting/variable AUTOENV_ENV_FILENAME to
AUTOENV_AUTH_FILE, and uses the [XDG
spec](http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables)
for the default location.
The new default location for the auth file will be
~/.local/share/autoenv_auth.
When the old setting is used, or the previous default exists, a warning
is given with instructions.
Fixes https://github.com/Tarrasch/zsh-autoenv/issues/31.
Closes https://github.com/Tarrasch/zsh-autoenv/pull/32.