Skip to content

Commit

Permalink
packages: support {$pkg}_uninstall events
Browse files Browse the repository at this point in the history
Emit uninstall events independent of uninstall.fish
fdeitylink authored and scorphus committed Mar 26, 2022
1 parent b27b3b5 commit 0cda2c0
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/en-US/Packages.md
Original file line number Diff line number Diff line change
@@ -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

7 changes: 5 additions & 2 deletions pkg/omf/functions/packages/omf.packages.remove.fish
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0cda2c0

Please sign in to comment.