File Tree Generator

Directory Tree Generation for Copcon.

This module provides functionality to generate a visual representation of the project’s directory structure.

class copcon.core.file_tree.FileTreeGenerator(directory, depth, file_filter)

Bases: object

Generates a tree-like directory structure for a given directory.

Traverses the directory up to a specified depth and applies file filters to exclude certain files and directories.

generate(current_dir=None, current_depth=0, prefix='')

Generate the directory tree as a string.

Parameters:
  • current_dir (Path, optional) – The current directory being traversed.

  • current_depth (int) – The current depth in the directory tree.

  • prefix (str) – The prefix string for the current level of the tree.

Returns:

The generated directory tree as a string.

Return type:

str