From 560c1c94b4fd7b9f2425c511d4f224d7de76fa3b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 18 Aug 2016 15:15:40 -0600 Subject: [PATCH] Fixed `-y|--all-yes` option for GPM::info --- system/src/Grav/Console/Gpm/InfoCommand.php | 46 ++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/system/src/Grav/Console/Gpm/InfoCommand.php b/system/src/Grav/Console/Gpm/InfoCommand.php index 1036c597c..dad532764 100644 --- a/system/src/Grav/Console/Gpm/InfoCommand.php +++ b/system/src/Grav/Console/Gpm/InfoCommand.php @@ -25,6 +25,8 @@ class InfoCommand extends ConsoleCommand */ protected $gpm; + protected $all_yes; + /** * */ @@ -60,6 +62,8 @@ class InfoCommand extends ConsoleCommand { $this->gpm = new GPM($this->input->getOption('force')); + $this->all_yes = $this->input->getOption('all-yes'); + $this->displayGPMRelease(); $foundPackage = $this->gpm->findPackage($this->input->getArgument('package')); @@ -133,38 +137,34 @@ class InfoCommand extends ConsoleCommand // display changelog information $questionHelper = $this->getHelper('question'); - $skipPrompt = $this->input->getOption('all-yes'); + $question = new ConfirmationQuestion("Would you like to read the changelog? [y|N] ", + false); + $answer = $this->all_yes ? true : $questionHelper->ask($this->input, $this->output, $question); - if (!$skipPrompt) { - $question = new ConfirmationQuestion("Would you like to read the changelog? [y|N] ", - false); - $answer = $questionHelper->ask($this->input, $this->output, $question); + if ($answer) { + $changelog = $foundPackage->changelog; - if ($answer) { - $changelog = $foundPackage->changelog; + $this->output->writeln(""); + foreach ($changelog as $version => $log) { + $title = $version . ' [' . $log['date'] . ']'; + $content = preg_replace_callback("/\d\.\s\[\]\(#(.*)\)/", function ($match) { + return "\n" . ucfirst($match[1]) . ":"; + }, $log['content']); + $this->output->writeln(''.$title.''); + $this->output->writeln(str_repeat('-', strlen($title))); + $this->output->writeln($content); $this->output->writeln(""); - foreach ($changelog as $version => $log) { - $title = $version . ' [' . $log['date'] . ']'; - $content = preg_replace_callback("/\d\.\s\[\]\(#(.*)\)/", function ($match) { - return "\n" . ucfirst($match[1]) . ":"; - }, $log['content']); - $this->output->writeln(''.$title.''); - $this->output->writeln(str_repeat('-', strlen($title))); - $this->output->writeln($content); - $this->output->writeln(""); - - $question = new ConfirmationQuestion("Press [ENTER] to continue or [q] to quit ", true); - if (!$questionHelper->ask($this->input, $this->output, $question)) { - break; - } - $this->output->writeln(""); + $question = new ConfirmationQuestion("Press [ENTER] to continue or [q] to quit ", true); + $answer = $this->all_yes ? false : $questionHelper->ask($this->input, $this->output, $question); + if (!$answer) { + break; } + $this->output->writeln(""); } } - $this->output->writeln(''); if ($installed && $updatable) {