mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Improves help command
This commit is contained in:
@ -45,7 +45,7 @@ final class Help implements HandlesArguments
|
||||
|
||||
$this->output->writeln([
|
||||
'',
|
||||
sprintf(' <fg=blue;options=bold>%s:</>', mb_strtoupper($title)),
|
||||
sprintf(' <fg=yellow;options=bold>%s OPTIONS:</>', mb_strtoupper($title)),
|
||||
]);
|
||||
|
||||
foreach ($options as $option) {
|
||||
@ -58,6 +58,8 @@ final class Help implements HandlesArguments
|
||||
'desc' => $description,
|
||||
] = $option;
|
||||
|
||||
$argument = $this->colorizeOptions($argument);
|
||||
|
||||
View::render('components.two-column-detail', [
|
||||
'left' => $argument,
|
||||
'right' => $description,
|
||||
@ -73,6 +75,16 @@ final class Help implements HandlesArguments
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Colorizes the given string options.
|
||||
*/
|
||||
private function colorizeOptions(string $argument): string
|
||||
{
|
||||
$argument = (string) preg_replace('/(--\w+)/', '<fg=blue;options=bold>$1</>', $argument);
|
||||
|
||||
return (string) preg_replace('/(-\w+)/', '<fg=blue;options=bold>$1</>', $argument);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, array{arg?: string, desc: string}>>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user