support COMPOSER env var in validate command (#6834)

* support COMPOSER env var in validate command
main
Markus Staab 7 years ago committed by Jordi Boggiano
parent 6256e17149
commit ecb26c7b75

@ -44,7 +44,7 @@ class ValidateCommand extends BaseCommand
new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'), new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'), new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'), new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file', './composer.json'), new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
)) ))
->setHelp(<<<EOT ->setHelp(<<<EOT
The validate command validates a given composer.json and composer.lock The validate command validates a given composer.json and composer.lock
@ -66,7 +66,7 @@ EOT
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$file = $input->getArgument('file'); $file = $input->getArgument('file') ?: Factory::getComposerFile();
$io = $this->getIO(); $io = $this->getIO();
if (!file_exists($file)) { if (!file_exists($file)) {

Loading…
Cancel
Save