From ba2a345305d1a214222e7a2b1b019199fcc32c94 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 14 Sep 2023 18:40:07 +0200 Subject: [PATCH] implemented also filter for files --- scan.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scan.py b/scan.py index abf22bf..b68c34e 100644 --- a/scan.py +++ b/scan.py @@ -124,7 +124,8 @@ def main(): if os.path.isdir(path): DirectoryHandler.handle_directory(path, file_filters=args.filetype, ignore_strings=args.ignore, ignore_hidden=args.ignore_hidden, verbose=args.verbose, no_comments=args.no_comments, compress=args.compress, strings=args.strings) elif os.path.isfile(path): - DirectoryHandler.handle_file(path, file_filters=args.filetype, ignore_strings=args.ignore, ignore_hidden=args.ignore_hidden, no_comments=args.no_comments, compress=args.compress) + if DirectoryHandler.should_print_file(path, file_filters=args.filetype, ignore_strings=args.ignore, ignore_hidden=args.ignore_hidden, include_strings=args.strings): + DirectoryHandler.handle_file(path, file_filters=args.filetype, ignore_strings=args.ignore, ignore_hidden=args.ignore_hidden, no_comments=args.no_comments, compress=args.compress) else: print(f"Error: {path} is neither a valid file nor a directory.") exit(1)