filenames cleanup

This commit is contained in:
Kirill Markin 2024-06-09 10:09:49 +02:00
parent 72ac64ceb6
commit bdc2f2be42
6 changed files with 235 additions and 429 deletions

View file

@ -65,12 +65,13 @@ def should_ignore_file(file_path, relative_path, gitignore_spec, content_ignore_
is_ignored_path(file_path) or
(gitignore_spec and gitignore_spec.match_file(relative_path)) or
(content_ignore_spec and content_ignore_spec.match_file(relative_path)) or
(tree_and_content_ignore_spec and tree_and_content_ignore_spec.match_file(relative_path))
(tree_and_content_ignore_spec and tree_and_content_ignore_spec.match_file(relative_path)) or
os.path.basename(file_path).startswith('repo-to-text_')
)
def is_ignored_path(file_path: str) -> bool:
ignored_dirs = ['.git']
ignored_files_prefix = ['repo_snapshot_']
ignored_files_prefix = ['repo-to-text_']
is_ignored_dir = any(ignored in file_path for ignored in ignored_dirs)
is_ignored_file = any(file_path.startswith(prefix) for prefix in ignored_files_prefix)
result = is_ignored_dir or is_ignored_file
@ -115,7 +116,7 @@ def save_repo_to_text(path='.', output_dir=None) -> str:
# Add timestamp to the output file name with a descriptive name
timestamp = datetime.utcnow().strftime('%Y-%m-%d-%H-%M-%S-UTC')
output_file = f'repo_snapshot_{timestamp}.txt'
output_file = f'repo-to-text_{timestamp}.txt'
# Determine the full path to the output file
if output_dir: