Last active
December 16, 2021 06:26
-
-
Save dongyuwei/e4224347130e8f51415c40e8a1e3a8bd to your computer and use it in GitHub Desktop.
test event handler of fish shell script
This file contains 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 custom_event_test --on-event test_event | |
echo 'event hook' | |
echo event test: $argv | |
end | |
emit test_event foo bar | |
function on_pwd_changed --on-variable PWD | |
echo 'on_pwd_changed hook' | |
echo ">>> The current dir is: " $PWD | |
end | |
cd ../ | |
cd - | |
function on_foo_changed --on-variable foo | |
echo ">>> foo is: " $foo | |
end | |
set foo bar | |
set foo foobarz | |
#### run it: `fish test_fish_event_handler.fish` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
also see https://github.com/jethrokuan/z/blob/master/conf.d/z.fish#L45