mirror of
https://github.com/kevinveenbirkenbach/directory-content-scanner.git
synced 2024-11-22 13:01:02 +01:00
Compare commits
No commits in common. "36c5b628128cfcac8e8b7ef3681298446ea1c329" and "632334f5749a11819df45b01408827b268b07640" have entirely different histories.
36c5b62812
...
632334f574
9
scan.py
9
scan.py
@ -79,14 +79,14 @@ class DirectoryHandler:
|
|||||||
if no_comments:
|
if no_comments:
|
||||||
file_type = os.path.splitext(file_path)[1]
|
file_type = os.path.splitext(file_path)[1]
|
||||||
content = CodeProcessor.remove_comments(content, file_type)
|
content = CodeProcessor.remove_comments(content, file_type)
|
||||||
print(f"<< START: {file_path} >>")
|
print(f"======== File Path: {file_path} ========")
|
||||||
if compress:
|
if compress:
|
||||||
compressed_content = CodeProcessor.compress(content)
|
compressed_content = CodeProcessor.compress(content)
|
||||||
print(f"COMPRESSED CODE: ")
|
print(f"======== Compressed Code ========")
|
||||||
print(compressed_content)
|
print(compressed_content)
|
||||||
else:
|
else:
|
||||||
print(content)
|
print(content)
|
||||||
print("<< END >>\n")
|
print("==================================\n")
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
print(f"Warning: Could not read file due to encoding issues: {file_path}")
|
print(f"Warning: Could not read file due to encoding issues: {file_path}")
|
||||||
exit(1)
|
exit(1)
|
||||||
@ -124,8 +124,7 @@ def main():
|
|||||||
if os.path.isdir(path):
|
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)
|
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):
|
elif os.path.isfile(path):
|
||||||
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)
|
||||||
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:
|
else:
|
||||||
print(f"Error: {path} is neither a valid file nor a directory.")
|
print(f"Error: {path} is neither a valid file nor a directory.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user