<commit_before><?php
/*
 * Copyright (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Cecil\Command;

use Cecil\Util\Plateform;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class CommandNewSite extends Command
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('new:site')
            ->setDescription('Create a new website')
            ->setDefinition(
                new InputDefinition([
                    new InputArgument('path', InputArgument::OPTIONAL, 'If specified, use the given path as working directory'),
                    new InputOption('force', 'f', InputOption::VALUE_NONE, 'Override the directory if already exist'),
                ])
            )
            ->setHelp('Create a new website in the current directory, or in <path> if provided.');
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->force = $input->getOption('force');

        try {
            /*if ($this->fs->exists($this->getPath() . '/' . self::CONFIG_FILE) && !$this->force) {
                if (!Confirm::prompt('Website already exists. Do you want to override it? [y/n]', 'y', 'n')) {
                    exit(0);
                }
            }*/
            $root = __DIR__.'/../../';
            if (Plateform::isPhar()) {
                $root = Plateform::getPharPath().'/';
            }
            $output->writeln('<info>Creating a new website...</info>');
            $this->fs->copy($root.'res/skeleton/config.yml', $this->getPath().'/'.self::CONFIG_FILE, true);
            $this->fs->mirror($root.'res/skeleton/content', $this->getPath().'/content');
            $this->fs->mirror($root.'res/skeleton/layouts', $this->getPath().'/layouts');
            $this->fs->mirror($root.'res/skeleton/static', $this->getPath().'/static');
            $output->writeln('Done!');
        } catch (\Exception $e) {
            throw new \Exception(sprintf($e->getMessage()));
        }

        return 0;
    }
}<commit_msg>Update CommandNewSite.php<commit_after><?php
/*
 * Copyright (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Cecil\Command;

use Cecil\Util\Plateform;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;

class CommandNewSite extends Command
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('new:site')
            ->setDescription('Create a new website')
            ->setDefinition(
                new InputDefinition([
                    new InputArgument('path', InputArgument::OPTIONAL, 'If specified, use the given path as working directory'),
                    new InputOption('force', 'f', InputOption::VALUE_NONE, 'Override the directory if already exist'),
                ])
            )
            ->setHelp('Create a new website in the current directory, or in <path> if provided.');
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->force = $input->getOption('force');

        try {
            if ($this->fs->exists($this->getPath().'/'.self::CONFIG_FILE) && !$this->force) {
                $helper = $this->getHelper('question');
                $question = new ConfirmationQuestion('Website already exists. Do you want to override it? [y/n]', false);
                if (!$helper->ask($input, $output, $question)) {
                    return;
                }
            }
            $root = __DIR__.'/../../';
            if (Plateform::isPhar()) {
                $root = Plateform::getPharPath().'/';
            }
            $output->writeln('<info>Creating a new website...</info>');
            $this->fs->copy($root.'res/skeleton/config.yml', $this->getPath().'/'.self::CONFIG_FILE, true);
            $this->fs->mirror($root.'res/skeleton/content', $this->getPath().'/content');
            $this->fs->mirror($root.'res/skeleton/layouts', $this->getPath().'/layouts');
            $this->fs->mirror($root.'res/skeleton/static', $this->getPath().'/static');
            $output->writeln('Done!');
        } catch (\Exception $e) {
            throw new \Exception(sprintf($e->getMessage()));
        }

        return 0;
    }
}
{'fraction_non_alphanumeric': 0.15877437325905291, 'fraction_numerical': 0.0005968961400716276, 'mean_word_length': 2.305062458908613, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 67, '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': '5084588', 'n_tokens_mistral': 1399, 'n_tokens_neox': 1362, 'n_words': 300}