Created
November 3, 2014 13:15
-
-
Save drewthorp/dbb7b6652a8b55b8db3a to your computer and use it in GitHub Desktop.
Fish shell function that runs either a script or set of commands upon entering a directory. This function requires my change of directory event (https://gist.github.com/drewthorp/d8e5d888be72244b8d8a), and as with as event capturing function (It seems) cannot be autoloading. The script .fs_script will be executed upon entering its containing dir…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fs_runscript -e directory_changed | |
| if test -f "./.fs_script" | |
| eval ("./.fs_script") | |
| end | |
| if test -f "./.fs_cmd" | |
| # read file and run contents | |
| set -l fs_cmd (cat ./.fs_cmd) | |
| eval $fs_cmd | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment