Skip to content

Commit

Permalink
[list] Remove messages when format is not txt. (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas committed Jan 28, 2018
1 parent fe4ea26 commit cae7eed
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,34 @@ public function doRun(InputInterface $input, OutputInterface $output)
$output
);

$messages = $messageManager->getMessages();
if ($this->showMessages($input)) {
$messages = $messageManager->getMessages();

foreach ($messages as $message) {
$type = $message['type'];
$io->$type($message['message']);
foreach ($messages as $message) {
$type = $message['type'];
$io->$type($message['message']);
}
}

return $code;
}

/**
* @param InputInterface $input
*
* @return bool
*/
private function showMessages(InputInterface $input)
{
$format = $input->hasOption('format')?$input->getOption('format'):'txt';

if ($format !== 'txt') {
return false;
}

return true;
}

/**
* registerEvents
*/
Expand Down

0 comments on commit cae7eed

Please sign in to comment.