packages: support {$pkg}_uninstall events

Emit uninstall events independent of uninstall.fish
pull/894/head
fdeitylink 3 years ago committed by Pablo Aguiar
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…
Cancel
Save