#!/usr/bin/env perl6

use Config::INI;
use Getopt::Long;

use CI::Gen;
my %params;
my $ret = get-options-from(@*ARGS,
    'basedir=s',
    'param=s%',
    'theme=s',
);
my $basedir = ($ret.{'basedir'} || '.');
my $ini-bn = ".ci-gen.ini";
my $ini = "$basedir/$ini-bn";
if (IO::Path.new($ini).e)
{
    my %h = Config::INI::parse_file($ini);
    my %n =%h<_>;
    %n.push(%h.grep(*.key ne '_'));
    %n.push(|$ret);
    $ret = %n;
}
CI::Gen::CI-Gen.new(
    basedir=>$basedir,
    params=>($ret.{'param'}.hash||{}),
    theme=>$ret.{'theme'}
).generate("foo");
