mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-24 14:26:08 +08:00
packages: support {$pkg}_uninstall events
Emit uninstall events independent of uninstall.fish
This commit is contained in:
parent
b27b3b5aba
commit
0cda2c0c1f
|
@ -120,6 +120,7 @@ Inside this hook, you can access two package-related variables:
|
|||
Packages can use this hook to clean up custom resources, etc.
|
||||
|
||||
> Note: for backwards-compatibility, uninstall hooks will also be run if they are located at `uninstall.fish` in the package root.
|
||||
> Hooks may also be triggered by listening for the event `{$package}_uninstall` or `uninstall_$package`.
|
||||
|
||||
# Make it public
|
||||
|
||||
|
|
|
@ -17,8 +17,11 @@ function omf.packages.remove -a pkg
|
|||
|
||||
# Run uninstall hook first.
|
||||
omf.packages.run_hook $path uninstall
|
||||
source $path/uninstall.fish 2> /dev/null;
|
||||
and emit uninstall_$pkg
|
||||
if test -f $path/uninstall.fish
|
||||
source $path/uninstall.fish 2> /dev/null
|
||||
end
|
||||
emit uninstall_$pkg
|
||||
emit {$pkg}_uninstall
|
||||
|
||||
if command rm -rf $path
|
||||
omf.bundle.remove "package" $pkg
|
||||
|
|
Loading…
Reference in New Issue
Block a user