MCPcopy Create free account
hub / github.com/FonaTech/Clouds-Coder / _print_tree

Method _print_tree

split_coder.py:1677–1688  ·  view source on GitHub ↗

Print a directory tree.

(root: Path, prefix: str = "", is_last: bool = True)

Source from the content-addressed store, hash-verified

1675
1676 @staticmethod
1677 def _print_tree(root: Path, prefix: str = "", is_last: bool = True) -> None:
1678 """Print a directory tree."""
1679 if prefix == "":
1680 print(f"\n{root.name}/")
1681 items = sorted(root.iterdir(), key=lambda p: (p.is_file(), p.name))
1682 for i, item in enumerate(items):
1683 last = i == len(items) - 1
1684 connector = "└── " if last else "├── "
1685 print(f"{prefix}{connector}{item.name}")
1686 if item.is_dir():
1687 extension = " " if last else "│ "
1688 Splitter._print_tree(item, prefix + extension, last)
1689
1690
1691# ─── Auto-Layout Generator ────────────────────────────────────────────────────

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected