<commit_before><?php

namespace Humbug\Command;

use Humbug\Adapter\Phpunit\ConfigurationLocator;
use Humbug\Exception\RuntimeException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;

class Configure extends Command
{
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if ($this->isAlreadyConfigured()) {
            $output->writeln(
                'Humbug configuration file "humbug.json" already exists. '
                . 'You may delete the file to start over.'
            );
            return 0;
        }

        $output->writeln('When choosing directories, you may enter each directory and press return.');
        $output->writeln('To exit directory selection, please leave the next answer blank and press return.');
        $output->write(PHP_EOL);

        $chDir = $this->resolveChDir($input, $output);

        $sourcesDirs = $this->getDirs($input, $output, 'What source directories do you want to include? : ');

        if (empty($sourcesDirs)) {
            $output->writeln('A source directory was not provided. Unable to generate "humbug.json".');
            return 0;
        }

        $excludeDirs = $this->getDirs($input, $output,
            'Any directories to exclude from within your source directories? :');

        $timeout = $this->getTimeout($input, $output);

        $textLogFile = $this->getTextLogFile($input, $output);

        $jsonLogFile = $this->getJsonLogFile($input, $output);

        if (!$this->isGenerationConfirmed($input, $output)) {
            $output->writeln('Aborted.');
            return 0;
        }

        $configuration = $this->createConfiguration(
            $sourcesDirs,
            $excludeDirs,<commit_msg>Some colors in configure command<commit_after><?php

namespace Humbug\Command;

use Humbug\Adapter\Phpunit\ConfigurationLocator;
use Humbug\Exception\RuntimeException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;

class Configure extends Command
{
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln(
            '<fg=green>Humbug configuration tool.' . PHP_EOL .
            'It will guide you through Humbug configuration in few seconds.</fg=green>' . PHP_EOL
        );

        if ($this->isAlreadyConfigured()) {
            $output->writeln(
                '<bg=red>Humbug configuration file "humbug.json" already exists. '
                . 'You may delete the file to start over.</bg=red>' . PHP_EOL
            );
            return 0;
        }

        $output->writeln('When choosing directories, you may enter each directory and press return.');
        $output->writeln('To exit directory selection, please leave the next answer blank and press return.');
        $output->write(PHP_EOL);

        $chDir = $this->resolveChDir($input, $output);

        $sourcesDirs = $this->getDirs($input, $output, 'What source directories do you want to include? : ');

        if (empty($sourcesDirs)) {
            $output->writeln('A source directory was not provided. Unable to generate "humbug.json".');
            return 0;
        }

        $excludeDirs = $this->getDirs($input, $output,
            'Any directories to exclude from within your source directories? :');

        $timeout = $this->getTimeout($input, $output);

        $textLogFile = $this->getTextLogFile($input, $output);

        $jsonLogFile = $this->getJsonLogFile($input, $output);

        if (!$this->isGenerationConfirmed($input, $output)) {
            $output->writeln('<fg=red>Aborted.</fg=red>' .PHP_EOL);
            return 0;
        }

        $configuration = $this->createConfiguration(
            $sourcesDirs,
            $excludeDirs,
{'fraction_non_alphanumeric': 0.11850458499882435, 'fraction_numerical': 0.0014107688690336232, 'mean_word_length': 2.8813868613138687, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 40, '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': '2101253', 'n_tokens_mistral': 1176, 'n_tokens_neox': 1141, 'n_words': 285}