From e4ceb863018fb2644c60412e313927ad57db1c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 6 Dec 2013 15:28:24 +0100 Subject: [PATCH] Allow to specify path to .php_cs file using --config-file option --- .gitignore | 1 - Symfony/CS/Console/Command/FixCommand.php | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b3102768940..5556efb4867 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ vendor phpunit.xml - diff --git a/Symfony/CS/Console/Command/FixCommand.php b/Symfony/CS/Console/Command/FixCommand.php index dd07c7301b5..a9f261bcef8 100644 --- a/Symfony/CS/Console/Command/FixCommand.php +++ b/Symfony/CS/Console/Command/FixCommand.php @@ -54,6 +54,7 @@ protected function configure() ->setDefinition(array( new InputArgument('path', InputArgument::REQUIRED, 'The path'), new InputOption('config', '', InputOption::VALUE_REQUIRED, 'The configuration name', null), + new InputOption('config-file', '', InputOption::VALUE_OPTIONAL, 'The path to a .php_cs file ', null), new InputOption('dry-run', '', InputOption::VALUE_NONE, 'Only shows which files would have been modified'), new InputOption('level', '', InputOption::VALUE_REQUIRED, 'The level of fixes (can be psr0, psr1, psr2, or all)', null), new InputOption('fixers', '', InputOption::VALUE_REQUIRED, 'A list of fixers to run'), @@ -126,6 +127,9 @@ protected function configure() ->fixers(array('indentation', 'elseif')) ->finder(\$finder) ; + +With the --config-file option you can specify the path to the +.php_cs file. EOF ); } @@ -155,6 +159,9 @@ protected function execute(InputInterface $input, OutputInterface $output) if (null === $config) { throw new \InvalidArgumentException(sprintf('The configuration "%s" is not defined', $input->getOption('config'))); } + } elseif ($input->getOption('config-file')) { + $file = $input->getOption('config-file'); + $config = include $file; } elseif (file_exists($file = $path.'/.php_cs')) { $config = include $file; $addSuppliedPathFromCli = false;