diff --git a/src/Composer/Command/UpdateCommand.php b/src/Composer/Command/UpdateCommand.php index 95c1fa0be..2234ed4cf 100644 --- a/src/Composer/Command/UpdateCommand.php +++ b/src/Composer/Command/UpdateCommand.php @@ -79,17 +79,20 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { - $composer = $this->getComposer(true, $input->getOption('no-plugins')); - $packages = $input->getArgument('packages'); - if ($input->getOption('interactive')) { - $packages = $this->getPackagesInteractively($input, $output, $composer, $packages); - } - if ($input->getOption('no-custom-installers')) { $output->writeln('You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.'); $input->setOption('no-plugins', true); } + $composer = $this->getComposer(true, $input->getOption('no-plugins')); + + $packages = $input->getArgument('packages'); + + if ($this->isInteractive($input)) { + $packages = $this->getPackagesInteractively($input, $output, $composer, $packages); + } + + $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress')); $io = $this->getIO(); $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output); @@ -177,22 +180,21 @@ EOT $packages = is_array($packages) ? $packages : array(); $output->writeln('NB: Empty package ends submission.'); // I couldn't find any better for now! - $continue = true; do { $question->setAutocompleterValues($autocompleterValues); $addedPackage = $helper->ask($input, $output, $question); - if (is_string($addedPackage)) { - if (!in_array($addedPackage, $packages)) { - $packages[] = $addedPackage; - $autocompleterValues = array_diff($autocompleterValues, array($addedPackage)); - } else { - $output->writeln(sprintf('The package "%s" was already added.', $package)); - } - } else { - $continue = false; + if (!is_string($addedPackage)) { + break; } - } while ($continue); + + if (!in_array($addedPackage, $packages)) { + $packages[] = $addedPackage; + $autocompleterValues = array_diff($autocompleterValues, array($addedPackage)); + } else { + $output->writeln(sprintf('The package "%s" was already added.', $package)); + } + } while (true); $packages = array_filter($packages); if (!$packages) { @@ -220,4 +222,9 @@ EOT throw new \RuntimeException('Installation aborted.'); } + + private function isInteractive($input) + { + return $input->getOption('interactive'); + } }