Skip to content

Commit

Permalink
Actually fix CLI output if STDOUT is not a tty
Browse files Browse the repository at this point in the history
  • Loading branch information
FO-nTTaX committed Apr 20, 2022
1 parent f8f2fab commit 212875d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Report/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,18 @@ private function updateCounter(): void {
* Update counters so we can show a nice progress bar
*/
private function addNonTtyCounterMaybe(): void {
$this->lineCounter++;
$this->totalCounter++;
if ( $this->lineCounter >= 60 ) {
echo ' ';
echo $this->makeCounterText();
echo PHP_EOL;
$this->lineCounter = 0;
} elseif ( $this->totalCounter === $this->amount ) {
echo str_repeat( ' ', 60 - $this->lineCounter + 1 );
echo $this->makeCounterText();
echo PHP_EOL;
$this->lineCounter = 0;
}
}

Expand Down

0 comments on commit 212875d

Please sign in to comment.