* Add a run_hooks function for the common task of running all hooks of a
[ikiwiki.git] / ikiwiki
diff --git a/ikiwiki b/ikiwiki
index a10876a96ba10b6fb888c13742f32c34ddf97939..28eba6f64e98e1298e9a32e61dbe6cb1f2897847 100755 (executable)
--- a/ikiwiki
+++ b/ikiwiki
@@ -68,11 +68,7 @@ sub getconfig () { #{{{
 
                if (! $config{setup}) {
                        loadplugins();
-                       if (exists $hooks{getopt}) {
-                               foreach my $id (keys %{$hooks{getopt}}) {
-                                       $hooks{getopt}{$id}{call}->();
-                               }
-                       }
+                       run_hooks(getopt => sub { shift->() });
                        if (grep /^-/, @ARGV) {
                                print STDERR "Unknown option: $_\n"
                                        foreach grep /^-/, @ARGV;