App-Midgen
view release on metacpan or search on metacpan
script/midgen view on Meta::CPAN
#!perl
use 5.008001;
use strict;
use warnings FATAL => 'all';
our $VERSION = '0.34';
use English qw( -no_match_vars );
local $OUTPUT_AUTOFLUSH = 1;
use Data::Printer {caller_info => 1,};
# we are doing this so we can run from git during development
# perl ~/GitHub/App-Midgen/script/midgen
use FindBin qw($Bin);
use lib map {"$Bin/$_"} qw( lib ../lib );
use App::Midgen;
use Time::Stamp 'gmstamp';
#######
# get options from ~/.midgenrc
#######
# Encode and decode JSON
use JSON::Tiny;
my $json = JSON::Tiny->new;
use File::Spec;
use File::Slurp::Tiny qw(read_file write_file);
my $midgenrc = File::Spec->catfile($ENV{HOME}, '.midgenrc');
my $config;
if (-e $midgenrc) {
$config = $json->decode(read_file($midgenrc));
}
#######
# Start of Menu
#######
use Getopt::Long;
Getopt::Long::Configure('bundling');
use Pod::Usage;
my $help = 0;
my $core = $config->{core} || 0;
my $dual_life = $config->{dual_life} || 0;
my $verbose = $config->{verbose} || 1;
my @format = $config->{format} || 'dsl';
my $experimental = 0;
my $quiet = $config->{quiet} || 0;
my $zero = $config->{zero} || 0;
my $debug = 0;
my $write = 0;
GetOptions(
'verbose|v+' => \$verbose,
'core|c!' => \$core,
'dual_life|l!' => \$dual_life,
'help|h|?' => \$help,
'experimental|x' => \$experimental,
'format|f=s' => \@format,
'quiet|q' => \$quiet,
'zero|z!' => \$zero,
'debug|d' => sub {
$core = 1;
$verbose = 3;
$debug = 1;
},
'write|w' => \$write,
) or pod2usage(2);
pod2usage(1) if $help;
#######
# run App::Midgen
#######
if ($verbose > 0) {
print 'Running midgen v' . $VERSION . "\n";
print 'Stamped -> ' . gmstamp($BASETIME) . "\n";
print 'Honouring $ENV{ANSI_COLORS_DISABLED}' . "\n"
if $ENV{ANSI_COLORS_DISABLED};
}
my $midgen = App::Midgen->new(
core => $core,
dual_life => $dual_life,
verbose => $verbose,
format => $format[-1],
experimental => $experimental,
quiet => $quiet,
zero => $zero,
debug => $debug,
);
p $midgen if $debug;
$midgen->run();
#######
# write config to ~/.midgenrc
( run in 2.263 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )