cli: Support file exclude/include filters in cros format
This allows repositories to configure
`cros format = cros format --check --exclude=... ${PRESUBMIT_FILES}`
in their PRESUBMIT.cfg when some file types are not ready
to adopt to the format mandated by cros format yet.
BUG=b:246861469
BUG=b:245439871
TEST=cros format cros/cros_format.py
TEST=cros format cros/cros_format.py --exclude='*.py'
TEST=cros format cros/cros_format.py --include='*.py' --exclude='*.py'
TEST=cros format --help
TEST=./run_tests cli/cros/cros_format_unittest.py
Change-Id: I77806b3f6eb4f1ba885052700b43dcc6e3c498a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4116312
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Li-Yu Yu <aaronyu@google.com>
Commit-Queue: Li-Yu Yu <aaronyu@google.com>
diff --git a/cli/command.py b/cli/command.py
index cd425ef..240e68d 100644
--- a/cli/command.py
+++ b/cli/command.py
@@ -133,6 +133,9 @@
# Whether command uses dry-run options.
use_dryrun_options = False
+ # Indicates whether command uses filter related commandline options.
+ use_filter_options = False
+
def __init__(self, options):
self.options = options