#!/usr/bin/env perl
+use 5.010;
use strict;
use warnings;
perl script/misc/update-wiki-pages config/wiki_pages.yml
+Or with prove(1):
+
+ prove -e 'perl script/misc/update-wiki-pages' config/wiki_pages.yml
+
=cut
# Get the command-line options
# On --help
help() if $help;
-help() unless $ARGV[0];
+my $out_file = $ARGV[0];
+$out_file //= 'config/wiki_pages.yml';
+
+help() unless -f $out_file;
# Get a API interface
my $mw = MediaWiki::API->new();
# Value pages
ok(1, " Getting value pages");
- my $cnt = stick_content_in_hash("tag", "Template:${lang}ValueDescription", \%feature);
+ $cnt = stick_content_in_hash("tag", "Template:${lang}ValueDescription", \%feature);
ok(1, " Got $cnt value pages");
$count{value} += $cnt;
}
ok(1, "Got a total of $count{$_} ${_}s") for qw[ key value ];
# Dump to .yml file
-open my $out, ">", $ARGV[0] or die "Can't open file '$ARGV[0]' supplied on the command line";
+open my $out, ">", $out_file or die "Can't open file '$out_file' supplied on the command line";
say $out "# THIS FILE IS AUTOGENERATED WITH THE script/misc/update-wiki-pages";
say $out "# PROGRAM DO NOT MANUALLY EDIT IT";
say $out "";