Comments (9)
How about calling a tear down function (on_leave
?) if it is defined in .env? For example, to deactivate a condo environment one might define this function in .env
.
function on_leave() {
echo "Deactivating environment"
source deactivate
}
I haven't considered the details but would something like this be useful?
from autoenv.
This would be nice, but since the scope of .env
right now is "any bash script", it's not really an easy thing to do.
We could reset environment variables to their original state.
from autoenv.
Agreed that this would be a good feature. What if you cd to a directory containing a .env, and then cd to another directory containing another .env? Maybe you want the cumulative effects of the two envs, but probably not.
I have similar sort of project that handles deactivating envs: https://bitbucket.org/krupan/albion/wiki/Home
Feel free to copy any of it, or to tell me it's stupid :-)
from autoenv.
👍
from autoenv.
+1
from autoenv.
👍 for resetting environment variables.
@kennethreitz Limiting the scope for environment variables only (not any bash script) sounds good, but dramatically changes the functionality of autoenv
, right?
from autoenv.
Correct.
from autoenv.
i mkdir "dac" a directory and touch .env with the line in the "dac"
deactivate
cd ..
now i can cd dac and deactivate and back
from autoenv.
Closing as this has been implemented in v0.3.0 with the .env.leave
file. It's not perfect and you would have to manually "deactive" the environment you have setup (i am keeping autoenv as simple as possible), but it is what you would if you want to do this. Sorry for the pings - I know this is an old thread.
from autoenv.
Related Issues (20)
- Freeze when running activate.sh on Mac Catalina OS HOT 21
- Is the pypi version not catching up?
- Created by mistake - ignore me
- brew version is outdated. HOT 1
- Odd behavior with nvm installed HOT 3
- Broken image ref in the README
- sourcing of activate.sh on OSx Big Sur causes hanging in Terminal HOT 3
- Git installation instructions are outdated HOT 1
- Ability to not override `cd` on source
- Properly use shelltest
- Uninstall autoenv - Mac OS Ventura 13.0 HOT 2
- Error bash: 1: No such file or directory HOT 3
- Add autoenv AUR package
- Error with nvm on Mac HOT 2
- Autoenv keep asking for permission HOT 5
- autoenv_check_authz_and_run:7: read-only variable: status HOT 1
- autoenv running on all directories in parent HOT 1
- Document usable varaibles in `.env` file
- Transfer repo back to @kennethreitz HOT 2
- Source parent directory's `.env.leave` file when leaving subdirectory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autoenv.