The format of this file is based on Keep a Changelog; this project adheres to Semantic Versioning.
Another yet-again long-awaited release! 🥳
As per the title, this mostly includes features, but also includes the usual bug fixes, documentation updates, and maintenance chores.
When cding to a directory with an .env (by default) file, autoenv used to always prompt to source the file:
$ cd ./dir
autoenv: WARNING:
autoenv: This is the first time you are about to source /home/edwin/autoenv/.hidden/.env:
autoenv:
autoenv: --- (begin contents) ---------------------------------------
autoenv: echo '.env has been sourced.'$
autoenv:
autoenv: --- (end contents) -----------------------------------------
autoenv: Are you sure you want to allow this? (y/N)Even when selecting n (no), autoenv would not remember that choice. Now, there is a new option!:
$ AUTOENV_VIEWER=cat cd ./dir
[autoenv] New or modified env file detected:
--- Contents of ".env" --------------------------------------------------------------------------------
echo '.env has been sourced.'
-------------------------------------------------------------------------------------------------------
[autoenv] Authorize this file? (y/n/d)Choose d (disable) if you no longer want any "source prompts" for this file. Note that if the file content changes, then your choice is reset and autoenv will prompt you yet again.
The AUTOENV_NOTAUTH_FILE shell variable is used to configure where this data is stored. Its format is identical to the one in AUTOENV_AUTH_FILE.
As you may have noticed in the above example, the prompt has been upgraded to read better, when AUTOENV_VIEWER is set to a non-empty variable.
By default, autoenv will use the old authorization prompt to reduce disruption for current users that are used to the old prompt. Opt-in by setting AUTOENV_VIEWER to a non-empty value, like cat. Another good value is less -N.
Thanks to @alissa-huskey! (#206)
The XDG Base Directory Specification is now adhered to. Some details:
- On a fresh install, both
AUTOENV_AUTH_FILEandAUTOENV_NOTAUTH_FILEare written under$HOME/.local/state/autoenv - If
AUTOENV_AUTH_FILEis already written under$HOME, then the newAUTOENV_NOTAUTH_FILEwill also be written under there for consistency - For maximum backwards-compatability, files are not moved to the new location; the old locations can still be used
Before invoking your shell script, autoenv sets the following environment variables:
AUTOENV_CUR_FILE- The file being sourcedAUTOENV_CUR_DIR- Equivalent todirname "$AUTOENV_CUR_FILE"
These were added a while back in 988723d2e1f5d905e9fcedee7e236a3855185ad5, but were undocumented. Besides convenience, documenting it allows users to be confident that the feature will not be removed. I have also added the checking of these values to the test suite.
By default, autoenv runs:
cd() {
autoenv_cd "${@}"
}This would override any pre-existing cd function, making it a bit annoying to work around if a custom cd function is desired (and defined before autoenv is evaluated).
Now, set AUTOENV_PRESERVE_CD to a non-empty string to prevent this behavior. autoenv_cd will still be exposed for invocation in custom cd functions.
Before, when cding from a/b to a/bz, a/b/.env.leave would not be sourced. Path matching did not use forward slashes as a "cutoff" when testing if directories are different. Now, in the aforementioned situation, the file is properly sourced.
Thanks to @tomtseng! (#238)
Let's say there exists the following directory structure:
~/project/.env
~/project/.env.leave
~/project/src
If the current directory is ~/project/src, and cd / is invoked, .env.leave was previously not executed. Now it is.
Thanks to @pashaosipyants! (#211)
The npm installation instructions included an incorrect installation path, which would lead to errors if followed. Now, it includes the correct paths.
Thanks to @wesleycoder! (#234)
And some less noticable, but still notable improvements:
- Improve installation instructions
- Made instructions more clear for the different operating systems and shells
- Add automated install script under scripts/install.sh
- Add documentation for uninstalling and updating
- Various refactoring
- Implement some tests in Bats
v0.3.0 - 2021-09-05
- Leave
$OLDPWDintact (#141) AUTOENV_CUR_DIRcontains leading double quote (#150)- Prevent any alias usage (#144)
- Broken mountpoint detection (#151)
- Add
AUTOENV_ASSUME_YES(#162) - Execute
.env.leavewhen leaving directory (#167) - Ensure parent directory of
AUTOENV_AUTH_FILEexists (#201) - Improve platform compatibility (#174, #176, #202)
v0.2.1 - 2016-10-18
- Remove debug output (#126)
- Paths with spaces on dash
- Custom names for .env (#109)
- Usage of double slashes (#125)
- Infinite loop when symlinking across mountpoints (#133)
- Don't allow chdir aliases
- Mountpoint detection (#138 #139)
- No more override of
$OLDPWD(#141) - .env files at mountpoint are now being found (#146)
v0.2.0 - 2016-08-08
- setup.py for pyPi
- setup.py in the Makefile
- Support for OS X
- Support for the dash shell
- Accept 'y' or 'Y' as answer
- Expose
AUTOENV_CUR_FILEandAUTOENV_CUR_DIR
- Fix spaces in filenames
- Strange grep behavior
- Look for a .env file when activating autoenv
- Fix sha1sum not being found
- Support aliased cd
- Require .env to be a regular file
- autoenv now works with noclobber
- Crash with zsh 5.1
- Don't run in mc
- Updated readme
- Export all variables
- Rewrote tests
- Follow .env files until the mountpoint
- Add quotes everywhere in the shell script
- Print hidden characters
v0.1.0 - 2012-02-15
- .env files need approval now
- Execution on zsh
- Put autoenv under a public license
v0.0.1 - 2012-02-13
- Initial public version of autoenv
- Allows executing .env files recursively
- Makefile for testing
- Unit tests with dtf
- Travis file for testing