Add ability to run commands when exiting a directory.

Fixes Issue #30