From: Joey Hess <joey@kodama.kitenet.net>
Date: Sun, 27 Jul 2008 03:00:44 +0000 (-0400)
Subject: allow --dumpsetup to be used w/o specifying srcdir and destdir
X-Git-Tag: 2.60~169
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/6a64d133526b25b46828bc75c2b3b99c0ab7e331?ds=inline

allow --dumpsetup to be used w/o specifying srcdir and destdir

shortcut tried to use srcdir in checkconfig; change it to not so this will
work.
---

diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm
index 8df60cfe2..dfc3cd7c7 100644
--- a/IkiWiki/Plugin/shortcut.pm
+++ b/IkiWiki/Plugin/shortcut.pm
@@ -6,11 +6,11 @@ use strict;
 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);
 } #}}}
 
-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);
diff --git a/ikiwiki.in b/ikiwiki.in
index febc8ff56..0390df7e1 100755
--- a/ikiwiki.in
+++ b/ikiwiki.in
@@ -88,10 +88,14 @@ sub getconfig () { #{{{
 
 		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 {