Skip to content

18 compress the excluded paths from the tree#19

Merged
simone-viozzi merged 2 commits intomainfrom
18-compress-the-excluded-paths-from-the-tree
Mar 9, 2025
Merged

18 compress the excluded paths from the tree#19
simone-viozzi merged 2 commits intomainfrom
18-compress-the-excluded-paths-from-the-tree

Conversation

@simone-viozzi
Copy link
Copy Markdown
Owner

Compress excluded paths in tree output and add tests

  • Refactor generate_tree() in src/gpt_copy/gpt_copy.py to compress directories excluded by the -e option.
    Directories matching the exclude patterns now display only one level of children (up to 3 items)
    followed by an ellipsis ("[...]") if additional items exist.
  • Update main() to pass the exclude patterns to generate_tree().
  • Bump project version in pyproject.toml to 2.3.0.
  • Add tests/test_tree_compression.py to verify the compressed view for excluded directories.

Refactor generate_tree and collect_files_content with helper functions

  • Extract helper functions _get_visible_entries, _compress_directory, and _process_file to improve code modularity and readability.
  • Update generate_tree to use these helpers for filtering visible entries and compressing excluded directories.
  • Simplify collect_files_content by delegating file processing to _process_file.

- Refactor generate_tree() in src/gpt_copy/gpt_copy.py to compress directories excluded by the -e option.
  Directories matching the exclude patterns now display only one level of children (up to 3 items)
  followed by an ellipsis ("[...]") if additional items exist.
- Update main() to pass the exclude patterns to generate_tree().
- Bump project version in pyproject.toml to 2.3.0.
- Add tests/test_tree_compression.py to verify the compressed view for excluded directories.
- Extract helper functions _get_visible_entries, _compress_directory, and _process_file to improve code modularity and readability.
- Update generate_tree to use these helpers for filtering visible entries and compressing excluded directories.
- Simplify collect_files_content by delegating file processing to _process_file.
@simone-viozzi simone-viozzi linked an issue Mar 9, 2025 that may be closed by this pull request
@simone-viozzi simone-viozzi merged commit 3eb3964 into main Mar 9, 2025
@simone-viozzi simone-viozzi deleted the 18-compress-the-excluded-paths-from-the-tree branch March 9, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compress the excluded paths from the tree

1 participant