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

namespace MadeYourDay\SVG\IconFontGeneratorCLI;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use MadeYourDay\SVG\IconFontGenerator;

/**
 * create-font command
 *
 * @author <NAME> <<EMAIL>>
 */
class CreateFontCommand extends Command{

	/**
	 * configures the create-font command
	 *
	 * @return void
	 */
	protected function configure(){
		$this
			->setName('create-font')
			->setDescription('Creates a SVG Font out of SGV files from a directory')
			->addArgument('directory', InputArgument::REQUIRED, 'path to directory containging SVG files')
			->addArgument('output-file', InputArgument::REQUIRED, 'path to the output file')
			->addOption('rename-files', null, InputOption::VALUE_NONE, 'if set, files without mapping information will be renamed to include the mapping information (e.g. my-icon.svg renamed to my-icon-xe001.svg)')
		;
	}

	/**
	 * creates a SVG Font out of SGV files from a directory
	 *
	 * @param  InputInterface  $input  input
	 * @param  OutputInterface $output output
	 * @return void
	 */
	protected function execute(InputInterface $input, OutputInterface $output){

		$directory = $input->getArgument('directory');
		$outputFile = $input->getArgument('output-file');

		$generator = new IconFontGenerator;

		$output->writeln('reading files from "'.$directory.'" ...');
		$generator->generateFromDir($directory, array(), $input->getOption('rename-files'));

		$output->writeln('writing font to "'.$outputFile.'" ...');
		file_put_contents($outputFile, $generator->getFont()->getXML());

		$output->getFormatter()->setStyle('success', new OutputFormatterStyle(null, null, array('bold', 'reverse')));

		$output->writeln('<success>created '.$outputFile.' successfully</success>');

	}

}<commit_msg>Added name option to create-font command<commit_after><?php
/*
 * Copyright MADE/YOUR/DAY <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace MadeYourDay\SVG\IconFontGeneratorCLI;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use MadeYourDay\SVG\IconFontGenerator;

/**
 * create-font command
 *
 * @author <NAME> <<EMAIL>>
 */
class CreateFontCommand extends Command{

	/**
	 * configures the create-font command
	 *
	 * @return void
	 */
	protected function configure(){
		$this
			->setName('create-font')
			->setDescription('Creates a SVG Font out of SGV files from a directory')
			->addArgument('directory', InputArgument::REQUIRED, 'path to directory containging SVG files')
			->addArgument('output-file', InputArgument::REQUIRED, 'path to the output file')
			->addOption('rename-files', 'r', InputOption::VALUE_NONE, 'if set, files without mapping information will be renamed to include the mapping information (e.g. my-icon.svg renamed to my-icon-xe001.svg)')
			->addOption('name', 'n', InputOption::VALUE_REQUIRED, 'name of the font')
		;
	}

	/**
	 * creates a SVG Font out of SGV files from a directory
	 *
	 * @param  InputInterface  $input  input
	 * @param  OutputInterface $output output
	 * @return void
	 */
	protected function execute(InputInterface $input, OutputInterface $output){

		$directory = $input->getArgument('directory');
		$outputFile = $input->getArgument('output-file');

		$generator = new IconFontGenerator;

		$output->writeln('reading files from "'.$directory.'" ...');
		$generator->generateFromDir($directory, array(
			'id' => $input->getOption('rename-files') ?: 'SVGFont',
		), $input->getOption('rename-files'));

		$output->writeln('writing font to "'.$outputFile.'" ...');
		file_put_contents($outputFile, $generator->getFont()->getXML());

		$output->getFormatter()->setStyle('success', new OutputFormatterStyle(null, null, array('bold', 'reverse')));

		$output->writeln('<success>created '.$outputFile.' successfully</success>');

	}

}
{'fraction_non_alphanumeric': 0.14367185786356657, 'fraction_numerical': 0.0013160780872998464, 'mean_word_length': 4.9921156373193165, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 52, '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': '5031181', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1298, 'n_words': 341}