diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-28 05:26:49 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-28 05:26:49 +0000 |
commit | 409e62021c5c05e0184a61d0692697c10a0b8283 (patch) | |
tree | b745279c2c83aee71c279692d680dd997c360f45 /ikiwiki | |
parent | 51d20d72f63b6f633747421c7afde171e189f50d (diff) |
* Add getopt hook type, this allows plugins to add new command-line options.
* Add --tagbase option to tag plugin.
Diffstat (limited to 'ikiwiki')
-rwxr-xr-x | ikiwiki | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -15,6 +15,7 @@ sub getconfig () { #{{{ if (! exists $ENV{WRAPPED_OPTIONS}) { %config=defaultconfig(); eval q{use Getopt::Long}; + Getopt::Long::Configure('pass_through'); GetOptions( "setup|s=s" => \$config{setup}, "wikiname=s" => \$config{wikiname}, @@ -66,6 +67,17 @@ sub getconfig () { #{{{ ) || usage(); if (! $config{setup}) { + loadplugins(); + if (exists $hooks{getopt}) { + foreach my $id (keys %{$hooks{getopt}}) { + $hooks{getopt}{$id}{call}->(); + } + } + if (grep /^-/, @ARGV) { + print STDERR "Unknown option: $_\n" + foreach grep /^-/, @ARGV; + usage(); + } usage() unless @ARGV == 2; $config{srcdir} = possibly_foolish_untaint(shift @ARGV); $config{destdir} = possibly_foolish_untaint(shift @ARGV); @@ -79,6 +91,7 @@ sub getconfig () { #{{{ if ($@) { error("WRAPPED_OPTIONS: $@"); } + loadplugins(); checkconfig(); } } #}}} |