<commit_before>package Pakket::CLI::Command::generate;
# ABSTRACT: The pakket install command

use strict;
use warnings;
use Log::Any::Adapter;
use Path::Tiny qw< path  >;
use List::Util qw< first >;

use Pakket::CLI '-command';
use Pakket::Log;
use Pakket::Scaffolder::Perl;

sub abstract    { 'Scaffold a project' }
sub description { 'Scaffold a project' }

sub opt_spec {
    return (
        [
            'name=s',
            'category/module name (e.g. "perl/Moose")',
        ],
        [
            'cpanfile=s',
            'cpanfile to configure from',
        ],
        [
            'config-dir=s',
            'directory to write the configuration to (TOML files)',
            { required => 1 },
        ],
        [
            'source-dir=s',
            'directory to write the sources to (downloads if provided)',
        ],
        [
            'index-file=s',
            'file to generate json configuration to',
        ],
        [
            'additional_phase=s@',
            "additional phases to use ('develop' = author_requires, 'test' = test_requires). configure & runtime are done by default.",
        ],
        [
            'extract',
            'extract downloaded source tarball',
            { default => 0 },
        ],
    );
}

sub validate_args {
    my ( $self, $opt, $args ) = @_;

    my $logger = Pakket::Log->cli_logger(5); # verbosity
    Log::Any::Adapter->set( 'Dispatch', dispatcher => $logger );

    @{ $args } and $self->usage_error("No extra arguments are allowed.\n");<commit_msg>generate: add 'verbose' flag support for logging<commit_after>package Pakket::CLI::Command::generate;
# ABSTRACT: The pakket install command

use strict;
use warnings;
use Log::Any::Adapter;
use Path::Tiny qw< path  >;
use List::Util qw< first >;

use Pakket::CLI '-command';
use Pakket::Log;
use Pakket::Scaffolder::Perl;

sub abstract    { 'Scaffold a project' }
sub description { 'Scaffold a project' }

sub opt_spec {
    return (
        [
            'name=s',
            'category/module name (e.g. "perl/Moose")',
        ],
        [
            'cpanfile=s',
            'cpanfile to configure from',
        ],
        [
            'config-dir=s',
            'directory to write the configuration to (TOML files)',
            { required => 1 },
        ],
        [
            'source-dir=s',
            'directory to write the sources to (downloads if provided)',
        ],
        [
            'index-file=s',
            'file to generate json configuration to',
        ],
        [
            'additional_phase=s@',
            "additional phases to use ('develop' = author_requires, 'test' = test_requires). configure & runtime are done by default.",
        ],
        [
            'extract',
            'extract downloaded source tarball',
            { default => 0 },
        ],
        [ 'verbose|v+',     'verbose output (can be provided multiple times)' ],
    );
}

sub validate_args {
    my ( $self, $opt, $args ) = @_;

    my $verbosity = $opt->{'verbose'}||0 + 2;
    my $logger = Pakket::Log->cli_logger($verbosity);
    Log::Any::Adapter->set( 'Dispatch', dispatcher => $logger );

    @{ $args } and $self->usage_error("No extra arguments are allowed.\n");
{'fraction_non_alphanumeric': 0.1400802221536563, 'fraction_numerical': 0.0021598272138228943, 'mean_word_length': 2.0074211502782933, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5609585', 'n_tokens_mistral': 970, 'n_tokens_neox': 948, 'n_words': 260}