]> sipb.mit.edu Git - ikiwiki.git/commitdiff
allow --dumpsetup to be used w/o specifying srcdir and destdir
authorJoey Hess <joey@kodama.kitenet.net>
Sun, 27 Jul 2008 03:00:44 +0000 (23:00 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Sun, 27 Jul 2008 03:00:44 +0000 (23:00 -0400)
shortcut tried to use srcdir in checkconfig; change it to not so this will
work.

IkiWiki/Plugin/shortcut.pm
ikiwiki.in

index 8df60cfe2a34b5e428e1eafcae88ac9c71a3c0ed..dfc3cd7c7b3a68a1df29d9d183400e535ea86e0a 100644 (file)
@@ -6,11 +6,11 @@ use strict;
 use IkiWiki 2.00;
 
 sub import { #{{{
 use IkiWiki 2.00;
 
 sub import { #{{{
-       hook(type => "checkconfig", id => "shortcut", call => \&checkconfig);
+       hook(type => "refresh", id => "shortcut", call => \&refresh);
        hook(type => "preprocess", id => "shortcut", call => \&preprocess_shortcut);
 } #}}}
 
        hook(type => "preprocess", id => "shortcut", call => \&preprocess_shortcut);
 } #}}}
 
-sub checkconfig () { #{{{
+sub refresh () { #{{{
        # Preprocess the shortcuts page to get all the available shortcuts
        # defined before other pages are rendered.
        my $srcfile=srcfile("shortcuts.mdwn", 1);
        # Preprocess the shortcuts page to get all the available shortcuts
        # defined before other pages are rendered.
        my $srcfile=srcfile("shortcuts.mdwn", 1);
index febc8ff56ed42ee876b85db2b235270961737963..0390df7e1f64d4755620857aed20b7b8576dae4c 100755 (executable)
@@ -88,10 +88,14 @@ sub getconfig () { #{{{
 
                if (! $config{setup} && ! $config{render}) {
                        loadplugins();
 
                if (! $config{setup} && ! $config{render}) {
                        loadplugins();
-                       usage() unless @ARGV == 2;
-                       $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
-                       $config{destdir} = possibly_foolish_untaint(shift @ARGV);
-                       checkconfig();
+                       if (@ARGV == 2) {
+                               $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
+                               $config{destdir} = possibly_foolish_untaint(shift @ARGV);
+                               checkconfig();
+                       }
+                       else {
+                               usage() unless $config{dumpsetup};
+                       }
                }
        }
        else {
                }
        }
        else {