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:
@ -1,4 +1,4 @@
|
|||||||
<div class="mx-2">
|
<div class="mx-2">
|
||||||
<span class="text-blue font-bold">USAGE:</span><span class="ml-1">pest</span><span class="ml-1 text-gray"><?php echo htmlspecialchars('<file>') ?> [options]</span>
|
<span class="text-yellow font-bold">USAGE:</span><span class="ml-1">pest</span><span class="ml-1 text-gray"><?php echo htmlspecialchars('<file>') ?> [options]</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ final class Help implements HandlesArguments
|
|||||||
|
|
||||||
$this->output->writeln([
|
$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) {
|
foreach ($options as $option) {
|
||||||
@ -58,6 +58,8 @@ 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' => $argument,
|
||||||
'right' => $description,
|
'right' => $description,
|
||||||
@ -73,6 +75,16 @@ final class Help implements HandlesArguments
|
|||||||
return $arguments;
|
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}>>
|
* @return array<string, array<int, array{arg?: string, desc: string}>>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
USAGE: pest <file> [options]
|
USAGE: pest <file> [options]
|
||||||
|
|
||||||
CONFIGURATION:
|
CONFIGURATION OPTIONS:
|
||||||
--init ............................ Initialise a standard Pest configuration
|
--init ............................ Initialise a standard Pest configuration
|
||||||
-c|--configuration <file> ....................... Read configuration from XML file
|
-c|--configuration <file> ....................... Read configuration from XML file
|
||||||
--no-configuration ......... Ignore default configuration file (phpunit.xml)
|
--no-configuration ......... Ignore default configuration file (phpunit.xml)
|
||||||
@ -14,7 +14,7 @@
|
|||||||
--generate-configuration Generate configuration file with suggested settings
|
--generate-configuration Generate configuration file with suggested settings
|
||||||
--migrate-configuration ....... Migrate configuration file to current format
|
--migrate-configuration ....... Migrate configuration file to current format
|
||||||
|
|
||||||
SELECTION:
|
SELECTION OPTIONS:
|
||||||
--list-suites ................................... List available test suites
|
--list-suites ................................... List available test suites
|
||||||
--testsuite <name> ............... Only run tests from the specified test suite(s)
|
--testsuite <name> ............... Only run tests from the specified test suite(s)
|
||||||
--exclude-testsuite <name> ........ Exclude tests from the specified test suite(s)
|
--exclude-testsuite <name> ........ Exclude tests from the specified test suite(s)
|
||||||
@ -28,7 +28,7 @@
|
|||||||
--filter <pattern> ........................................ Filter which tests to run
|
--filter <pattern> ........................................ Filter which tests to run
|
||||||
--test-suffix <suffixes> Only search for test in files with specified suffix(es). Default: Test.php,.phpt
|
--test-suffix <suffixes> Only search for test in files with specified suffix(es). Default: Test.php,.phpt
|
||||||
|
|
||||||
EXECUTION:
|
EXECUTION OPTIONS:
|
||||||
--process-isolation ................ Run each test in a separate PHP process
|
--process-isolation ................ Run each test in a separate PHP process
|
||||||
--globals-backup ................. Backup and restore $GLOBALS for each test
|
--globals-backup ................. Backup and restore $GLOBALS for each test
|
||||||
--static-backup ......... Backup and restore static properties for each test
|
--static-backup ......... Backup and restore static properties for each test
|
||||||
@ -55,7 +55,7 @@
|
|||||||
--order-by <order> Run tests in order: default|defects|duration|no-depends|random|reverse|size
|
--order-by <order> Run tests in order: default|defects|duration|no-depends|random|reverse|size
|
||||||
--random-order-seed <N> .......... Use a specific random seed <N> for random order
|
--random-order-seed <N> .......... Use a specific random seed <N> for random order
|
||||||
|
|
||||||
REPORTING:
|
REPORTING OPTIONS:
|
||||||
--colors <flag> ............... Use colors in output ("never", "auto" or "always")
|
--colors <flag> ............... Use colors in output ("never", "auto" or "always")
|
||||||
--columns <n> .................... Number of columns to use for progress output
|
--columns <n> .................... Number of columns to use for progress output
|
||||||
--columns max ............ Use maximum number of columns for progress output
|
--columns max ............ Use maximum number of columns for progress output
|
||||||
@ -71,7 +71,7 @@
|
|||||||
--testdox ................. Report test execution progress in TestDox format
|
--testdox ................. Report test execution progress in TestDox format
|
||||||
--no-interaction ........................ Disable TestDox progress animation
|
--no-interaction ........................ Disable TestDox progress animation
|
||||||
|
|
||||||
LOGGING:
|
LOGGING OPTIONS:
|
||||||
--log-junit <file> ................ Log test execution in JUnit XML format to file
|
--log-junit <file> ................ Log test execution in JUnit XML format to file
|
||||||
--log-teamcity <file> .............. Log test execution in TeamCity format to file
|
--log-teamcity <file> .............. Log test execution in TeamCity format to file
|
||||||
--testdox-html <file> ........... Write agile documentation in HTML format to file
|
--testdox-html <file> ........... Write agile documentation in HTML format to file
|
||||||
@ -81,7 +81,7 @@
|
|||||||
--log-events-verbose-text <file> Stream events as plain text to file (with telemetry information)
|
--log-events-verbose-text <file> Stream events as plain text to file (with telemetry information)
|
||||||
--no-logging .................................. Ignore logging configuration
|
--no-logging .................................. Ignore logging configuration
|
||||||
|
|
||||||
CODE COVERAGE:
|
CODE COVERAGE OPTIONS:
|
||||||
--coverage ..... Generate code coverage report and output to standard output
|
--coverage ..... Generate code coverage report and output to standard output
|
||||||
--coverage --min Set the minimum required coverage percentage, and fail if not met
|
--coverage --min Set the minimum required coverage percentage, and fail if not met
|
||||||
--coverage-crap4j <file> ...... Generate code coverage report in Crap4J XML format
|
--coverage-crap4j <file> ...... Generate code coverage report in Crap4J XML format
|
||||||
@ -95,7 +95,7 @@
|
|||||||
--disable-coverage-ignore Disable attributes and annotations for ignoring code coverage
|
--disable-coverage-ignore Disable attributes and annotations for ignoring code coverage
|
||||||
--no-coverage ........................... Ignore code coverage configuration
|
--no-coverage ........................... Ignore code coverage configuration
|
||||||
|
|
||||||
MISCELLANEOUS:
|
MISCELLANEOUS OPTIONS:
|
||||||
-h|--help .................................... Prints this usage information
|
-h|--help .................................... Prints this usage information
|
||||||
--version ..................................... Prints the version and exits
|
--version ..................................... Prints the version and exits
|
||||||
--atleast-version <min> ....... Checks that version is greater than min and exits
|
--atleast-version <min> ....... Checks that version is greater than min and exits
|
||||||
|
|||||||
Reference in New Issue
Block a user