|
7 | 7 | * @version 1.12.0
|
8 | 8 | */
|
9 | 9 | function usage() {
|
| 10 | + $options = array( |
| 11 | + "--src" => |
| 12 | + "Root of the source directory tree or a file (can be repeated for multiple sources).", |
| 13 | + |
| 14 | + "--exclude" => |
| 15 | + "[Optional] A directory or file that needs to be excluded (can be repeated for multiple exclusions).", |
| 16 | + |
| 17 | + "--format" => |
| 18 | + "[Optional] Output format (html/text/xml/xml_console/console/html_console). Defaults to 'html'.", |
| 19 | + |
| 20 | + "--outdir" => |
| 21 | + "[Optional] Report Directory. Defaults to './style-report'.", |
| 22 | + |
| 23 | + "--config" => |
| 24 | + "[Optional] The name of the config file'.", |
| 25 | + |
| 26 | + "--debug" => |
| 27 | + "[Optional] Add some debug logs (warning, very verbose)'.", |
| 28 | + |
| 29 | + "--linecount" => |
| 30 | + "[Optional] Generate a report on the number of lines of code (JavaNCSS format)'.", |
| 31 | + |
| 32 | + "--progress" => |
| 33 | + "[Optional] Prints a message noting the file and every line that is covered by PHPCheckStyle.", |
| 34 | + |
| 35 | + "--lang" => |
| 36 | + "[Optional] Language file to use for the result (en-us by default).", |
| 37 | + |
| 38 | + "--quiet" => |
| 39 | + "[Optional] Quiet mode.", |
| 40 | + |
| 41 | + "--help" => |
| 42 | + "Display this usage information.", |
| 43 | + ); |
| 44 | + |
10 | 45 | echo "Usage: " . $_SERVER['argv'][0] . " <options>\n";
|
11 | 46 | echo "\n";
|
12 | 47 | echo " Options: \n";
|
13 |
| - echo " --src Root of the source directory tree or a file (can be repeated for multiple sources).\n"; |
14 |
| - echo " --exclude [Optional] A directory or file that needs to be excluded (can be repeated for multiple exclusions).\n"; |
15 |
| - echo " --format [Optional] Output format (html/text/xml/xml_console/console/html_console). Defaults to 'html'.\n"; |
16 |
| - echo " --outdir [Optional] Report Directory. Defaults to './style-report'.\n"; |
17 |
| - echo " --config [Optional] The name of the config file'.\n"; |
18 |
| - echo " --debug [Optional] Add some debug logs (warning, very verbose)'.\n"; |
19 |
| - echo " --linecount [Optional] Generate a report on the number of lines of code (JavaNCSS format)'.\n"; |
20 |
| - echo " --progress [Optional] Prints a message noting the file and every line that is covered by PHPCheckStyle.\n"; |
21 |
| - echo " --lang [Optional] Language file to use for the result (en-us by default).\n"; |
22 |
| - echo " --quiet [Optional] Quiet mode.\n"; |
23 |
| - echo " --help Display this usage information.\n"; |
| 48 | + foreach ($options as $option => $description) { |
| 49 | + echo " " . str_pad($option, 16, " ") . $description . "\n"; |
| 50 | + } |
24 | 51 | exit();
|
25 | 52 | }
|
26 | 53 |
|
@@ -119,7 +146,7 @@ function usage() {
|
119 | 146 | }
|
120 | 147 |
|
121 | 148 | // check that source directory is specified and is valid
|
122 |
| -if ($options['src'] == false) { |
| 149 | +if (!$options['src']) { |
123 | 150 | echo "\nPlease specify a source directory/file using --src option.\n\n";
|
124 | 151 | usage();
|
125 | 152 | }
|
|
0 commit comments