defunkt / rip

Take back your $LOAD_PATH. Deprecated and unmaintained.
MIT License
366 stars 39 forks source link

rip-env - #114

Open defunkt opened 14 years ago

defunkt commented 14 years ago

like cd - -- jumps back to the previous ripenv. Would be neat.

cldwalker commented 14 years ago

I was actually thinking of implementing that the other day. However if we tried saving the last env as cd does i.e. by setting ENV['RIPOLDENV'], it gets complicated. The only to set a current shell variable is with a shell function so rip-env (and rip-create) would have to be wrapped by shell functions of the same name which set ENV['RIPOLDENV'] to the old ripenv.

An easier way to save the last ripenv would be to just append it to ~/.rip/.env_history. But then the last ripenv is global to all shell sessions.

cldwalker commented 14 years ago

Ended up implementing this using josh's sweet sh-helpers: http://github.com/cldwalker/rip/tree/env_dash

The only downside is that for this to work it overrides rip-env and thus rip-sh-helpers prints a warning. To avoid the warning, we can put an exception in there for rip-env or rename rip-env. If you like this implementation, I can add some tests before you merge.