Skip to content

Commit

Permalink
Merge pull request #10 from shopwareLabs/improve-output-formatting
Browse files Browse the repository at this point in the history
improve output formatting
  • Loading branch information
JanPietrzyk authored Nov 1, 2016
2 parents da71f01 + 92e132a commit ad90ddb
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/Application/ClimateLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,31 @@ public function finishScript(Script $script)
public function logCommandStart(string $shellCommand, int $line, bool $isIgnoreError, int $index, int $max)
{
$index++;
$this->cliMate->yellow("\n({$index}/{$max}) Starting\n<bold>> {$shellCommand}</bold>");
$this->cliMate->yellow()->inline("\n({$index}/{$max}) Starting\n<bold>> {$shellCommand}</bold>\n\t");
}

/**
* @param string $response
*/
public function err(string $response)
{
$lines = explode("\n", $response);

foreach ($lines as $line) {
$this->cliMate->red("\t$line");
}
$this->cliMate->red()->inline($this->formatOutput($response));
}

/**
* @param string $response
*/
public function out(string $response)
{
$lines = explode(PHP_EOL, $response);

foreach ($lines as $rowRaw) {
$row = trim($rowRaw);

if (!$row) {
continue;
}
$this->cliMate->green()->inline($this->formatOutput($response));
}

$this->cliMate->green("\t" . $row);
}
/**
* @param string $response
* @return string
*/
private function formatOutput(string $response) :string
{
return str_replace(PHP_EOL, PHP_EOL . "\t", $response);
}
}

0 comments on commit ad90ddb

Please sign in to comment.