From d7b3facf66ccaa81130f167535ae4a52b1fd6ac1 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 17 Feb 2022 02:41:09 +0100 Subject: [PATCH] Docs: show all options in help and README This commit syncs the three lists of the supported options: * The processing of received arguments in the `Application` class. * The CLI help in the `Settings` class. * The options shown in the README. I have verified that: * The options in all three lists are now in the same order to make future maintenance more straight-forward. Includes having all functional short options at the top of the lists. * All options are now shown in the help and the README. * The descriptions in the help and in the README are complete and largely the same (minus the "further reading" links shown in the README). Includes: * Fixing a typo in the help `-asp` vs `--asp`. * Line length management for the CLI help. * Minor grammatical improvement. Fixes 81 --- README.md | 39 ++++++++++++++++++++------------------- src/Application.php | 16 ++++++++++------ src/Settings.php | 16 ++++++++-------- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 8aa90c3..cb6b242 100644 --- a/README.md +++ b/README.md @@ -67,25 +67,26 @@ It is strongly recommended for existing users of the (unmaintained) ## Command line options -- `-p ` Specify PHP-CGI executable to run (default: 'php'). -- `-s, --short` Set short_open_tag to On (default: Off). -- `-a, --asp` Set asp_tags to On (default: Off). -- `-e ` Check only files with selected extensions separated by comma. (default: php,php3,php4,php5,phtml,phpt) -- `--exclude` Exclude a file or directory. If you want exclude multiple items, use multiple exclude parameters. -- `-j ` Run jobs in parallel (default: 10). -- `--colors` Force enable colors in console output. -- `--no-colors` Disable colors in console output. -- `--no-progress` Disable progress in console output. -- `--checkstyle` Output results as Checkstyle XML. -- `--json` Output results as JSON string (requires PHP 5.4). -- `--gitlab` Output results for the GitLab Code Quality widget (requires PHP 5.4), see more in [Code Quality](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html) documentation. -- `--blame` Try to show git blame for row with error. -- `--git ` Path to Git executable to show blame message (default: 'git'). -- `--stdin` Load files and folder to test from standard input. -- `--ignore-fails` Ignore failed tests. -- `--syntax-error-callback` File with syntax error callback for ability to modify error, see more in [example](doc/syntax-error-callback.md) -- `-h, --help` Print this help. -- `-V, --version` Display this application version. +- `-p ` Specify PHP-CGI executable to run (default: 'php'). +- `-s`, `--short` Set short_open_tag to On (default: Off). +- `-a`, `--asp` Set asp_tags to On (default: Off). +- `-e ` Check only files with selected extensions separated by comma. (default: php,php3,php4,php5,phtml,phpt) +- `-j ` Run jobs in parallel (default: 10). +- `--exclude` Exclude a file or directory. If you want exclude multiple items, use multiple exclude parameters. +- `--colors` Enable colors in console output. (disables auto detection of color support) +- `--no-colors` Disable colors in console output. +- `--no-progress` Disable progress in console output. +- `--checkstyle` Output results as Checkstyle XML. +- `--json` Output results as JSON string (requires PHP 5.4). +- `--gitlab` Output results for the GitLab Code Quality Widget (requires PHP 5.4), see more in [Code Quality](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html) documentation.. +- `--blame` Try to show git blame for row with error. +- `--git ` Path to Git executable to show blame message (default: 'git'). +- `--stdin` Load files and folder to test from standard input. +- `--ignore-fails` Ignore failed tests. +- `--show-deprecated` Show deprecations (default: Off). +- `--syntax-error-callback` File with syntax error callback for ability to modify error, see more in [example](doc/syntax-error-callback.md). +- `-h`, `--help` Print this help. +- `-V`, `--version` Display the application version ## Recommended excludes for Symfony framework diff --git a/src/Application.php b/src/Application.php index 4b4017e..fe36128 100644 --- a/src/Application.php +++ b/src/Application.php @@ -77,25 +77,29 @@ private function showOptions() Options: -p Specify PHP-CGI executable to run (default: 'php'). -s, --short Set short_open_tag to On (default: Off). - -a, -asp Set asp_tags to On (default: Off). + -a, --asp Set asp_tags to On (default: Off). -e Check only files with selected extensions separated by comma. (default: php,php3,php4,php5,phtml,phpt) + -j Run jobs in parallel (default: 10). --exclude Exclude a file or directory. If you want exclude multiple items, use multiple exclude parameters. - -j Run jobs in parallel (default: 10). - --colors Enable colors in console output. (disables auto detection of color support) + --colors Enable colors in console output. + (disables auto detection of color support) --no-colors Disable colors in console output. --no-progress Disable progress in console output. - --json Output results as JSON string. - --gitlab Output results for the GitLab Code Quality Widget. --checkstyle Output results as Checkstyle XML. + --json Output results as JSON string + (requires PHP 5.4). + --gitlab Output results for the GitLab Code Quality Widget + (requires PHP 5.4). --blame Try to show git blame for row with error. --git Path to Git executable to show blame message (default: 'git'). --stdin Load files and folder to test from standard input. --ignore-fails Ignore failed tests. + --show-deprecated Show deprecations (default: Off). --syntax-error-callback File with syntax error callback for ability to modify error -h, --help Print this help. - -V, --version Display this application version + -V, --version Display the application version HELP; } diff --git a/src/Settings.php b/src/Settings.php index 40cb8b1..4622910 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -152,10 +152,6 @@ public static function parseArguments(array $arguments) $settings->aspTags = true; break; - case '--exclude': - $settings->excluded[] = $arguments->getNext(); - break; - case '-e': $settings->extensions = array_map('trim', explode(',', $arguments->getNext())); break; @@ -164,6 +160,10 @@ public static function parseArguments(array $arguments) $settings->parallelJobs = max((int) $arguments->getNext(), 1); break; + case '--exclude': + $settings->excluded[] = $arguments->getNext(); + break; + case '--colors': $settings->colors = self::FORCED; break; @@ -176,6 +176,10 @@ public static function parseArguments(array $arguments) $settings->showProgress = false; break; + case '--checkstyle': + $settings->format = self::FORMAT_CHECKSTYLE; + break; + case '--json': $settings->format = self::FORMAT_JSON; break; @@ -184,10 +188,6 @@ public static function parseArguments(array $arguments) $settings->format = self::FORMAT_GITLAB; break; - case '--checkstyle': - $settings->format = self::FORMAT_CHECKSTYLE; - break; - case '--git': $settings->gitExecutable = $arguments->getNext(); break;