Spaces:
Running
on
Zero
Running
on
Zero
Create display_utils.py
Browse files- display_utils.py +17 -0
display_utils.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def format_output(extracted_content, repo_url):
|
2 |
+
formatted_output = f"# Repository URL: {repo_url}\n\n"
|
3 |
+
for file_data in extracted_content:
|
4 |
+
if isinstance(file_data, dict) and 'header' in file_data:
|
5 |
+
formatted_output += f"### File: {file_data['header']['name']}\n"
|
6 |
+
formatted_output += f"**Type:** {file_data['header']['type']}\n"
|
7 |
+
formatted_output += f"**Size:** {file_data['header']['size']} bytes\n"
|
8 |
+
formatted_output += f"**Created:** {file_data['header']['creation_date']}\n"
|
9 |
+
formatted_output += f"**Modified:** {file_data['header']['modification_date']}\n"
|
10 |
+
formatted_output += "#### Content:\n"
|
11 |
+
formatted_output += f"```\n{file_data['content']}\n```\n\n"
|
12 |
+
if file_data["summary"]:
|
13 |
+
formatted_output += "#### Summary:\n"
|
14 |
+
formatted_output += f"```\n{file_data['summary']}\n```\n\n"
|
15 |
+
else:
|
16 |
+
formatted_output += "Error in file data format.\n"
|
17 |
+
return formatted_output
|