Almost-minimal filesystem based blog.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

74 lines
1.8 KiB

#!/usr/bin/env perl
=pod
=head1 NAME
wrt-config - show configuration values, including defaults
=head1 USAGE
wrt config
# Specify a different config file:
wrt config --config ./wrt.json ...
=head1 DESCRIPTION
C<wrt-config> displays configuration values for the current wrt repository,
including both those overridden in the current F<wrt.json> and those set
by default.
For now, this just uses C<Data::Dumper>, and outputs a whole bunch of stuff
that may not be very interesting, since basically all the values are jammed
into a single object. Ideally, it could show which values are defaults and
which have been set from a config file or derived from the structure of the
archive.
=head1 LICENSE
wrt is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
=head1 AUTHOR
Brennen Bearnes <code@p1k3.com>
=cut
use 5.10.0;
use strict;
use warnings;
no warnings 'uninitialized';
use Data::Dumper;
use App::WRT;
use Carp;
use Getopt::Long;
use Pod::Usage;
# 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 $config_file = 'wrt.json';
GetOptions(
'config=s' => \$config_file,
help => sub { pod2usage(0) },
) or pod2usage(2);
unless (-e $config_file) {
croak "No wrt config file found. Tried: $config_file";
}
my $w = App::WRT::new_from_file($config_file);
# With --stdin, take names of entries to display from standard input, one line
# per name. Otherwise, take names from arguments.
print Dumper($w);
exit(0);