From ada55c28f85fad557e4feeaf5d6a52ca9c5ca014 Mon Sep 17 00:00:00 2001 From: tligui_y Date: Wed, 16 Jul 2025 13:42:08 +0200 Subject: [PATCH] Update json_to_tree.py --- json_to_tree.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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()