@@ -37,11 +37,14 @@ class PHPCS_Diff_CLI_Command extends WP_CLI_Command {
3737 * [--excluded-exts=<excluded-exts>]
3838 * : Ignore specified extensions. Use comma for separating multiple extensions
3939 *
40+ * [--folder=<folder>]
41+ * : Process files in specific folder
42+ *
4043 * ## EXAMPLES
4144 * wp phpcs-diff --repo="hello-dolly" --start_revision=99998 --end_revision=100000
4245 *
4346 * @subcommand phpcs-diff
44- * @synopsis --repo=<repo> --start_revision=<start-revision> --end_revision=<end-revision> [--standard=<standard>] [--format=<format>] [--nocache] [--ignore-diff-too-big] [--excluded-exts=<excluded-exts>]
47+ * @synopsis --repo=<repo> --start_revision=<start-revision> --end_revision=<end-revision> [--standard=<standard>] [--format=<format>] [--nocache] [--ignore-diff-too-big] [--excluded-exts=<excluded-exts>] [--folder=<folder>]
4548 */
4649 public function __invoke ( $ args , $ assoc_args ) {
4750
@@ -58,6 +61,11 @@ public function __invoke( $args, $assoc_args ) {
5861 if ( true === array_key_exists ( 'excluded-exts ' , $ assoc_args ) && false === empty ( $ assoc_args ['excluded-exts ' ] ) ) {
5962 $ excluded_exts = array_map ( 'sanitize_text_field ' , explode ( ', ' , $ assoc_args ['excluded-exts ' ] ) );
6063 }
64+ if ( true === array_key_exists ( 'folder ' , $ assoc_args ) ) {
65+ $ folder = sanitize_title ( $ assoc_args ['folder ' ] );
66+ } else {
67+ $ folder = '' ;
68+ }
6169
6270 // @todo: replace SVN version control backend with any other parser you might want to use - eg.: git
6371 require_once ( PHPCS_DIFF_PLUGIN_DIR . 'backends/class-phpcs-diff-svn.php ' );
@@ -77,7 +85,7 @@ public function __invoke( $args, $assoc_args ) {
7785 if ( true === isset ( $ excluded_exts ) && false === empty ( $ excluded_exts ) && true === is_array ( $ excluded_exts ) ) {
7886 $ phpcs ->set_excluded_extensions ( $ excluded_exts );
7987 }
80- $ found_issues = $ phpcs ->run ( $ start_revision , $ end_revision );
88+ $ found_issues = $ phpcs ->run ( $ start_revision , $ end_revision, $ folder );
8189
8290 if ( is_wp_error ( $ found_issues ) ) {
8391 WP_CLI ::error ( $ found_issues ->get_error_message (), true );
0 commit comments