Skip to content

Commit 83fc22d

Browse files
committed
πŸ’„ Improve the process status labels
1 parent 5a72e9e commit 83fc22d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

β€Žsrc/Console/Concerns/HasProcessTask.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@ public function processTask(object $process): void
3131

3232
$this->clear();
3333

34-
$description = Str::contains($process->status, 'failed') ?
34+
$status = strtolower($process->status);
35+
36+
$description = Str::contains($status, 'error') ?
3537
"<fg=red;options=bold>βœ–</> Failed <fg=red>{$process->name}</>" :
3638
"<fg=blue;options=bold>βœ”</> Finished <fg=blue>{$process->name}</>";
3739

40+
$description = Str::contains($status, 'cancelled') ?
41+
"<fg=yellow;options=bold>⚠</> Cancelled <fg=yellow>{$process->name}</>" :
42+
$description;
43+
3844
$descriptionWidth = mb_strlen(preg_replace("/\<[\w=#\/\;,:.&,%?]+\>|\\e\[\d+m/", '$1', $description) ?? '');
3945

4046
$this->output->write(" $description ", false);
@@ -53,8 +59,10 @@ public function processTask(object $process): void
5359
$this->output->write(str_repeat('<fg=gray>.</>', $dots), false);
5460
$this->output->write("<fg=gray>{$elapsed}</>", false);
5561

56-
$this->output->writeln(
57-
Str::is($process->status, 'finished') ? ' <fg=green;options=bold>DONE</>' : ' <fg=red;options=bold>FAIL</>'
58-
);
62+
$statusLabel = Str::is($status, 'finished') ? ' <fg=green;options=bold>DONE</>' : ' <fg=red;options=bold>FAIL</>';
63+
$statusLabel = Str::contains($status, 'cancelled') ?
64+
' <fg=yellow;options=bold>SKIP</>' : $statusLabel;
65+
66+
$this->output->writeln($statusLabel);
5967
}
6068
}

0 commit comments

Comments
Β (0)