Add ability to run commands when exiting a directory.