diff --git a/json_to_tree.py b/json_to_tree.py index 9928245a..5b73eb11 100644 --- a/json_to_tree.py +++ b/json_to_tree.py @@ -1,3 +1,4 @@ +from io import StringIO from rich.console import Console from rich.tree import Tree import json @@ -27,12 +28,16 @@ def main(): os.makedirs("ci-reports/markdown", exist_ok=True) - console = Console(record=True, force_terminal=True, color_system="truecolor") + buffer = StringIO() + console = Console(file=buffer, record=True, force_terminal=True, color_system="truecolor") + root = Tree(f"📁 {file_path}") build_tree(data, root) + console.print(root) + with open("ci-reports/markdown/json-tree-view.txt", "w") as f: f.write(console.export_text(clear=False)) if __name__ == "__main__": - main() \ No newline at end of file + main()