Comments (7)
Mmm... Very interesting.
For example, I have ~/Projects/node
, and .in
file in ~/Projects
. When I execute cd ~/Projects/node
, this plugin execute .in
file.
Can you provide your dir structure, and .in
file?
from autoenv.
Here's a concrete example:
$ tree test/
test/
├── project-a
└── project-b
2 directories, 0 files
$ cat test/.in
echo "Adding $PWD/node_modules/bin to the PATH"
$ cd test/project-a
Adding /home/pieter/test/project-a/node_modules/bin to the PATH
$ cd ../project-b
$
Nothing happens when I cd ../project-b
while what I would like to happen is that it would execute the test/.in file again.
from autoenv.
@piether Are you sure that you need this behaviour? You already have $PWD/node_modules/bin
in your $PATH, and sourcing this file again will produce duplicates in your $PATH.
from autoenv.
But the value of $PWD is different when I change directories, so the expression needs to be re-evaluated, no? I didn't bother including an .out file but I would avoid duplicates in the PATH that way.
Here's an even more elaborated example of my problem:
test/.in:
echo "Adding $PWD/node_modules/bin to the PATH"
export PATH=$PWD/node_modules/bin:$PATH
echo "New PATH: $PATH"
$ tree test/
test/
├── project-a
└── project-b
└── node_modules
└── bin
└── grunt
4 directories, 1 file
$ cd test/project-a
Adding /home/pieter/test/project-a/node_modules/bin to the PATH
New PATH: /home/pieter/test/project-a/node_modules/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$ cd ../project-b
$ grunt
zsh: command not found: grunt
$ cd / 127 ↵
$ cd ~/test/project-b
Adding /home/pieter/test/project-b/node_modules/bin to the PATH
New PATH: /home/pieter/test/project-b/node_modules/bin:/home/pieter/test/project-a/node_modules/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$ grunt
$
So the project-b/bin directory is only on the PATH after I cd /
and then go back into it.
from autoenv.
@piether I understand you. It's a bug in the plugin. For file ~/Projects/.in
, when you execute cd ~/Projects/project
, $PWD
need to be ~/Projects
, but not ~/Projects/project
from autoenv.
After thinking about it once more, I conclude:
- you can put common stuff in parent directory
.in
and.out
files that are not related to the exact location youcd
into. E.g. anAWS_PROFILE
for all projects for a certain customer - if you want to set something that is related to the exact location, you need an explicit
.in
and.out
in each directory where you want this behaviour.
from autoenv.
@piether I make a mistake in my comment. it's normal behaviour of $PWD. Instead of using $PWD in .in
files, you need to use $(dirname $0)/your_path_with_bin
. So, you can use something like this
for node_path in $(dirname $0)/*/node_modules/.bin; do
export PATH=$PATH:$node_path
done
from autoenv.
Related Issues (15)
- Name colisions with another oh-my-zsh plugin HOT 1
- .env file loaded twice HOT 3
- Env file is executed before environment is ready. HOT 3
- Comparison with Tarrasch/zsh-autoenv
- autoenv blocks when changing from ~/a to ~/ab HOT 2
- autoenv blocks when entering a subdirectory HOT 2
- Error "autoenv_chdir:2: unknown file attribute" HOT 3
- check_and_run:8: permission denied HOT 14
- Consider using .env.local before .env HOT 2
- .out does not seem to be executed
- The location of the Zsh Plugin Standard has changed HOT 2
- $1 is passed to .env files HOT 2
- bat pager interferes with output HOT 1
- It can`t work HOT 2
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.