Issue when pushing current directory (gem_home $PWD)
I wanted my GEM_HOME to be in ~/.gem so I put the call to gem_home $HOME in my .zshrc
But given that any new Terminal session already start in ~, then the pushd $HOME command executed by the gem_home_push function, realizing that I'm already in ~, doesn't add the current directory to the pushd stack.
As a result, when calling popd later on line 18, I get this error printed on my terminal:
gem_home_push:popd:18: directory stack empty
This doesn't actually cause any issue in my use case, but can still have consequences:
- This message is annoying and could alarm people not really knowing what it means (one of my coworker to which I suggested using your script asked me "what does it mean, did I do something wrong?")
- It could have side-effects when using outside of the
rcfile, like in the middle of a terminal session.
e.g. if the user used pushd on its own, then later calls gem_home . or gem_home $PWD, then the pushd won't add anything to the stack but the popd will pop to the last pushed directory and mess its pushd stack
~ $ pushd Documents
Documents $ gem_home .
~ $ # I expected to still be in Documents at this point
Confirmed, really annoying bug 😦
Looks to be same thing as in #7