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.
I have noticed that `autostash` called an (accidentally)
defined/overwritten `stash` function.
While it's not possible to put this into a local scope, this will at
least make it less polluting by default (when autostashing is not used).
Additionally we could source it always (not just once), but then it
would only re-overwrite the function.
A better fix would be to prefix the functions explicitly, e.g.
`autoenv_autostash` etc.
Closes https://github.com/Tarrasch/zsh-autoenv/pull/42.
The variables are local now, which makes them being handled correctly
when calling `autoenv_source_parent`.
Without this, a call to `autoenv_source_parent` overwrites the values in
the current scope.
stdout might be redirected, e.g. with "cd - >/dev/null", and this
message should appear in stderr probably anyway.
I've tried to add a test for this, by redirecting stdout in .zshenv, but
cram does not handle this well (and appears to redirect stderr to stdout
anyway).
The globals are not necessary and can cause problems with
AUTO_NAME_DIRS.
- Use funcsourcetrace[1] instead of _autoenv_source_dir.
- Use OLDPWD instead of _autoenv_chpwd_prev_dir.
Fixes#33.
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.
This is not really necessary, except for the convenience of being in the
.env file's directory during the hook.
But it messes around with the "cd history", e.g. `cd -`!
To reference the .env file or its directory, `$autoenv_env_file` and
`${autoenv_env_file:h}` can be used instead.