diff --git a/resources/views/usage.php b/resources/views/usage.php index e52db575..8a3555e9 100644 --- a/resources/views/usage.php +++ b/resources/views/usage.php @@ -1,4 +1,4 @@
- USAGE:pest') ?> [options] + USAGE:pest') ?> [options]
diff --git a/src/Plugins/Help.php b/src/Plugins/Help.php index e8d814c5..615dd7d2 100644 --- a/src/Plugins/Help.php +++ b/src/Plugins/Help.php @@ -45,7 +45,7 @@ final class Help implements HandlesArguments $this->output->writeln([ '', - sprintf(' %s:', mb_strtoupper($title)), + sprintf(' %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+)/', '$1', $argument); + + return (string) preg_replace('/(-\w+)/', '$1', $argument); + } + /** * @return array> */ diff --git a/tests/.snapshots/help-command.txt b/tests/.snapshots/help-command.txt index e4d8166f..9fd71c08 100644 --- a/tests/.snapshots/help-command.txt +++ b/tests/.snapshots/help-command.txt @@ -3,7 +3,7 @@ USAGE: pest [options] - CONFIGURATION: + CONFIGURATION OPTIONS: --init ............................ Initialise a standard Pest configuration -c|--configuration ....................... Read configuration from XML file --no-configuration ......... Ignore default configuration file (phpunit.xml) @@ -14,7 +14,7 @@ --generate-configuration Generate configuration file with suggested settings --migrate-configuration ....... Migrate configuration file to current format - SELECTION: + SELECTION OPTIONS: --list-suites ................................... List available test suites --testsuite ............... Only run tests from the specified test suite(s) --exclude-testsuite ........ Exclude tests from the specified test suite(s) @@ -28,7 +28,7 @@ --filter ........................................ Filter which tests to run --test-suffix 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 --globals-backup ................. Backup and restore $GLOBALS for each test --static-backup ......... Backup and restore static properties for each test @@ -55,7 +55,7 @@ --order-by Run tests in order: default|defects|duration|no-depends|random|reverse|size --random-order-seed .......... Use a specific random seed for random order - REPORTING: + REPORTING OPTIONS: --colors ............... Use colors in output ("never", "auto" or "always") --columns .................... Number of columns to use 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 --no-interaction ........................ Disable TestDox progress animation - LOGGING: + LOGGING OPTIONS: --log-junit ................ Log test execution in JUnit XML format to file --log-teamcity .............. Log test execution in TeamCity format to file --testdox-html ........... Write agile documentation in HTML format to file @@ -81,7 +81,7 @@ --log-events-verbose-text Stream events as plain text to file (with telemetry information) --no-logging .................................. Ignore logging configuration - CODE COVERAGE: + CODE COVERAGE OPTIONS: --coverage ..... Generate code coverage report and output to standard output --coverage --min Set the minimum required coverage percentage, and fail if not met --coverage-crap4j ...... Generate code coverage report in Crap4J XML format @@ -95,7 +95,7 @@ --disable-coverage-ignore Disable attributes and annotations for ignoring code coverage --no-coverage ........................... Ignore code coverage configuration - MISCELLANEOUS: + MISCELLANEOUS OPTIONS: -h|--help .................................... Prints this usage information --version ..................................... Prints the version and exits --atleast-version ....... Checks that version is greater than min and exits