diff options
-rwxr-xr-x | bin/pkg | 1 | ||||
-rw-r--r-- | man/5/pkg.conf | 14 |
2 files changed, 15 insertions, 0 deletions
@@ -378,6 +378,7 @@ function global_hook { update_provides $1 'remove' ;; esac + (( $+functions[pkg_hook_$2] )) && pkg_hook_$2 $1 } # Set the correct origin diff --git a/man/5/pkg.conf b/man/5/pkg.conf index b508807..7c7230a 100644 --- a/man/5/pkg.conf +++ b/man/5/pkg.conf @@ -45,6 +45,20 @@ Operate in debug mode if 1 If 1, automatically execute 'pkg update' before 'pkg push' and 'pkg remote-update' before 'pkg upgrade' +=item B<pkg_hook_>I<hook> () {I<content>} + +Define the global hook I<hook>, its I<content> will be executed +together with pkg's global hooks; the name of the package for which the hook is +being executed will be given as first parameter and is accessible throug B<$1>. +The hook is just a zsh function, so you can use any valid syntax you want, +including newlines. +See zsh(1) for more + +Valid I<hook> names are: post-add, pre-update, post-update, pre-remove. +Note thatt post-add automatically executes post-update + +Example: pkg_hook_post-update () {clear_line; echo "Hello from package $1!"} + =back =head1 SEE ALSO |