From a7934b8952cd3106222a2ffa89dbc126285b2fe6 Mon Sep 17 00:00:00 2001
From: sanj <67624670+iodrift@users.noreply.github.com>
Date: Thu, 19 Dec 2024 17:49:57 -0800
Subject: [PATCH] Auto-update: Thu Dec 19 17:49:57 PST 2024

---
 tablemd | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100755 tablemd

diff --git a/tablemd b/tablemd
new file mode 100755
index 0000000..d3936c9
--- /dev/null
+++ b/tablemd
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import sys
+
+def to_markdown_table(text):
+    lines = text.strip().split('\n')
+    # Split each line and pad with spaces to ensure alignment
+    rows = [line.split() for line in lines]
+    
+    # Create the markdown header row
+    header = ' | '.join(rows[0])
+    # Create separator row with correct number of columns
+    separator = ' | '.join(['---'] * len(rows[0]))
+    # Create data rows
+    data_rows = [' | '.join(row) for row in rows[1:]]
+    
+    # Combine all parts
+    return f"| {header} |\n| {separator} |\n" + \
+           '\n'.join(f"| {row} |" for row in data_rows)
+
+# Can be used with pipe input: ollama ls | python script.py
+print(to_markdown_table(sys.stdin.read()))
+