<commit_before><?php
namespace Czim\PxlCms\Commands;

use Czim\PxlCms\Generator\Generator;
use Illuminate\Console\Command;
use Event;

class GenerateCommand extends Command
{

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'pxlcms:generate
                                {--dry-run : Analyzes and shows debug output, but does not write files }
                                {--models-only : Only generates models}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Generate app files based on PXL CMS database content.';


    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $modelsOnly = (bool) $this->option('models-only');
        $dryRun     = (bool) $this->option('dry-run');

        $this->listenForLogEvents();

        $generator = new Generator( ! $dryRun, $this);

        $generator->generate();

        // todo: handle logging output for cli

        $this->info('Done.');
    }

    protected function listenForLogEvents()
    {
        $verbose = $this->option('verbose');

        Event::listen('pxlcms.logmessage', function($message, $level) use ($verbose) {
<commit_msg>generate command cleanup and --auto flag added<commit_after><?php
namespace Czim\PxlCms\Commands;

use Czim\PxlCms\Generator\Generator;
use Illuminate\Console\Command;
use Event;

class GenerateCommand extends Command
{

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'pxlcms:generate
                                {--dry-run : Analyzes and shows debug output, but does not write files }
                                {--auto : Disable user interaction }
                                {--models-only : Only generates models}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Generate app files based on PXL CMS database content.';


    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $modelsOnly  = (bool) $this->option('models-only');
        $dryRun      = (bool) $this->option('dry-run');
        $interactive = ! (bool) $this->option('auto');

        $this->listenForLogEvents();

        $generator = new Generator( ! $dryRun, $this);

        $generator->generate();

        $this->info('Done.');
    }

    protected function listenForLogEvents()
    {
        $verbose = $this->option('verbose');

        Event::listen('pxlcms.logmessage', function($message, $level) use ($verbose) {

{'fraction_non_alphanumeric': 0.12634876435781414, 'fraction_numerical': 0.0, 'mean_word_length': 2.080385852090032, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7369512', 'n_tokens_mistral': 811, 'n_tokens_neox': 782, 'n_words': 209}