#!/usr/bin/env perl

=pod

=head1 NAME

wrt-render-all - utility for rendering static HTML files from entries

=head1 USAGE

    wrt render-all
    wrt render-all --config ./wrt.json ...
    wrt render-all --help

=head1 DESCRIPTION

tk tk tk

=cut

use 5.10.0;

use strict;
use warnings;
no  warnings 'uninitialized';

use Getopt::Long;
use Pod::Usage;
use App::WRT;

# Handle options, including help generated from the POD above.  See:
# - http://perldoc.perl.org/Getopt/Long.html#User-defined-subroutines-to-handle-options
# - https://metacpan.org/pod/Pod::Usage
# - http://michael.thegrebs.com/2014/06/08/Pod-Usage/
my $render_all  = 0;
my $config_file = 'wrt.json';
GetOptions(
  config => \$config_file,
  help   => sub { pod2usage(0) },
) or pod2usage(2);

unless (-e $config_file) {
  die "No wrt config file found.  Tried: $config_file";
}

my $w = App::WRT::new_from_file($config_file);
$w->render();

exit(0);
