diff --git a/README.md b/README.md index 9d02598..a2c9063 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,13 @@ Give a try, use the included `testcases.php` to generate a report: *Example: -x="php,inc"* ``` +**-p** +``` + Print progress output. + Print a message to stderr as each file is being analyzed. + *Example: -p* +``` + **--php** ``` File path to the PHP binary to use for syntax checking. diff --git a/classes/options.php b/classes/options.php index 41daca5..f2e4b20 100644 --- a/classes/options.php +++ b/classes/options.php @@ -85,7 +85,14 @@ class options { 'description' => 'A comma separated list of file extensions to consider as PHP files. Defaults to "php"', 'example' => '-x="php,inc"', 'comma_delimited' => true - ] + ], + 'p' => [ + 'option' => self::OPTION_OPTIONAL, + 'value' => self::VALUE_NONE, + 'comment' => 'Print progress output.', + 'description' => 'Print a message to stderr as each file is being analyzed.', + 'example' => '-p', + ], ]; /** diff --git a/mar.php b/mar.php index 2bc879e..57013ad 100644 --- a/mar.php +++ b/mar.php @@ -113,8 +113,12 @@ private function run() { } else { $checkSyntax = false; } + $print_progress = $this->options->getOption('p'); while (($lines = $this->scanner->scanNextFile()) !== false) { + if ($print_progress) { + fprintf(STDERR, "Scanning '%s'\n", $filePath); + } $totalFiles++; //Check syntax and assign a line to grab if needed.