mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix: Help Command
This commit is contained in:
@ -58,11 +58,9 @@ final class Help implements HandlesArguments
|
|||||||
'desc' => $description,
|
'desc' => $description,
|
||||||
] = $option;
|
] = $option;
|
||||||
|
|
||||||
$argument = $this->colorizeOptions($argument);
|
|
||||||
|
|
||||||
View::render('components.two-column-detail', [
|
View::render('components.two-column-detail', [
|
||||||
'left' => $argument,
|
'left' => $this->colorizeOptions($argument),
|
||||||
'right' => $description,
|
'right' => preg_replace(['/</', '/>/'], ['[', ']'], $description),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,9 +78,11 @@ final class Help implements HandlesArguments
|
|||||||
*/
|
*/
|
||||||
private function colorizeOptions(string $argument): string
|
private function colorizeOptions(string $argument): string
|
||||||
{
|
{
|
||||||
$argument = (string) preg_replace('/(--\w+)/', '<fg=blue;options=bold>$1</>', $argument);
|
return preg_replace(
|
||||||
|
['/</', '/>/', '/(-+[\w-]+)/'],
|
||||||
return (string) preg_replace('/(-\w+)/', '<fg=blue;options=bold>$1</>', $argument);
|
['[', ']', '<fg=blue;options=bold>$1</>'],
|
||||||
|
$argument
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user