<commit_before><?php
namespace AndKirby\MageDbHelper\Command;

use AndKirby\MageDbHelper\Exception;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * CommitHooks files installer
 *
 * @package AndKirby\MageDbHelper\Command
 */
class Install extends CommandAbstract
{
    /**
     * MySQL import command
     *
     * @var string
     */
    protected $mySqlImportCommand;

    /**
     * Construct
     *
     * @param string $userDir
     * @param string $srcRoot
     */
    public function __construct($userDir, $srcRoot)
    {
        $this->userDir = $userDir;
        $this->srcDir  = $srcRoot;
        parent::__construct();
    }

    /**
     * Init default helpers
     *
     * @return $this
     */
    protected function configureCommand()
    {
        $this->setName('install');
        $this->setHelp(
            'This command can install available DB helpers into your database.'
        );
        $this->setDescription(
            'This command can install available DB helpers into your database.'
        );
        return $this;
    }

    /**
     * Execute command
     *
     * @param InputInterface  $input
     * @param OutputInterface $output
     * @return int
     * @throws Exception
     */
    public function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $this->testMysql($input, $output);
            $this->importScripts($input, $output);
        } catch (Exception $e) {
            if ($this->isVeryVerbose($output)) {
                throw $e;
            } else {
                $output->writeln($e->getMessage());
                return 1;
            }
        }

        $database = $input->getOption('mysql-database');
        $output->writeln(
            "Script files have been imported into database '$database'."
        );
        return 0;
    }

    /**
     * Init input definitions
     *
     * @return $this
     */
    protected function configureInput()
    {
        $this->addOption(
            'mysql-user', '-u', InputOption::VALUE_REQUIRED,
            'MySQL username to connect.'
        );
        $this->addOption(
            'mysql-password', '-p', InputOption::VALUE_OPTIONAL,
            'MySQL username to connect.'
        );
        $this->addOption(
            'no-password', '-n', InputOption::VALUE_NONE,
            'Skip using MySQL password.'
        );
        $this->addOption(
            'mysql-host', '-t', InputOption::VALUE_OPTIONAL,
            'MySQL DB host to connect.'
        );<commit_msg> - Fixed short name of no-password.<commit_after><?php
namespace AndKirby\MageDbHelper\Command;

use AndKirby\MageDbHelper\Exception;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * CommitHooks files installer
 *
 * @package AndKirby\MageDbHelper\Command
 */
class Install extends CommandAbstract
{
    /**
     * MySQL import command
     *
     * @var string
     */
    protected $mySqlImportCommand;

    /**
     * Construct
     *
     * @param string $userDir
     * @param string $srcRoot
     */
    public function __construct($userDir, $srcRoot)
    {
        $this->userDir = $userDir;
        $this->srcDir  = $srcRoot;
        parent::__construct();
    }

    /**
     * Init default helpers
     *
     * @return $this
     */
    protected function configureCommand()
    {
        $this->setName('install');
        $this->setHelp(
            'This command can install available DB helpers into your database.'
        );
        $this->setDescription(
            'This command can install available DB helpers into your database.'
        );
        return $this;
    }

    /**
     * Execute command
     *
     * @param InputInterface  $input
     * @param OutputInterface $output
     * @return int
     * @throws Exception
     */
    public function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $this->testMysql($input, $output);
            $this->importScripts($input, $output);
        } catch (Exception $e) {
            if ($this->isVeryVerbose($output)) {
                throw $e;
            } else {
                $output->writeln($e->getMessage());
                return 1;
            }
        }

        $database = $input->getOption('mysql-database');
        $output->writeln(
            "Script files have been imported into database '$database'."
        );
        return 0;
    }

    /**
     * Init input definitions
     *
     * @return $this
     */
    protected function configureInput()
    {
        $this->addOption(
            'mysql-user', '-u', InputOption::VALUE_REQUIRED,
            'MySQL username to connect.'
        );
        $this->addOption(
            'mysql-password', '-p', InputOption::VALUE_OPTIONAL,
            'MySQL username to connect.'
        );
        $this->addOption(
            'no-password', '-o', InputOption::VALUE_NONE,
            'Skip using MySQL password.'
        );
        $this->addOption(
            'mysql-host', '-t', InputOption::VALUE_OPTIONAL,
            'MySQL DB host to connect.'
        );
{'fraction_non_alphanumeric': 0.12113790504898267, 'fraction_numerical': 0.0007535795026375283, 'mean_word_length': 1.8759479956663054, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '3730149', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1465, 'n_words': 333}