From: Antoine Beaupré Date: Mon, 30 Oct 2017 02:51:38 GMT Subject: [PATCH 3/7] remote-mediawiki: show known namespace choices on failure Message-ID: <20171030025142.19421-4-anarcat@debian.org> In-Reply-To: <20171030025142.19421-1-anarcat@debian.org> If we fail to find a requested namespace, we should tell the user which ones we know about, since those were already fetched. This allows users to fetch all namespaces by specifying a dummy namespace, failing, then copying the list of namespaces in the config. Eventually, we should have a flag that allows fetching all namespaces automatically. Reviewed-by: Antoine Beaupré Signed-off-by: Antoine Beaupré --- contrib/mw-to-git/git-remote-mediawiki.perl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl index a1d783789..e7616e1a2 100755 --- a/contrib/mw-to-git/git-remote-mediawiki.perl +++ b/contrib/mw-to-git/git-remote-mediawiki.perl @@ -1334,7 +1334,9 @@ sub get_mw_namespace_id { my $id; if (!defined $ns) { - print {*STDERR} "No such namespace ${name} on MediaWiki.\n"; + my @namespaces = sort keys %namespace_id; + for (@namespaces) { s/ /_/g; } + print {*STDERR} "No such namespace ${name} on MediaWiki, known namespaces: @namespaces\n"; $ns = {is_namespace => 0}; $namespace_id{$name} = $ns; } -- 2.11.0