Cybrkyd's git repositories

GitGen • commit: 4056c39

commit 4056c39dc0b690ec3eb9dc777f0e400f1416e5f2eb0c201e53df590b99484f50
author cybrkyd <noreply@cybrkyd.com> 2026-01-16 10:48:46 +0000
committer cybrkyd <noreply@cybrkyd.com> 2026-01-16 10:48:46 +0000

Commit Message

Added colour coding to main index dates to show active repos in green. Where repos are active in the past 31 days, they are green; if older, default grey colour.

📊 Diffstat

gitgen.py 19
1 files changed, 16 insertions(+), 3 deletions(-)

Diff

diff --git a/gitgen.py b/gitgen.py
index db1a6a7..11bf00c 100644
--- a/gitgen.py
+++ b/gitgen.py
@@ -18,7 +18,7 @@ from concurrent.futures import ThreadPoolExecutor
class GitRepoScanner:
"""Scans and processes Git repositories"""
- def __init__(self, base_path: str = "/home/cybr/Work/cybrkyd-git"):
+ def __init__(self, base_path: str = "/home/cybr/Work/git-projects"):
self.base_path = Path(base_path).resolve()
self.repos = []
self.commit_cache: Dict[str, Dict] = {}
@@ -268,7 +268,7 @@ class HTMLGenerator:
def generate_index(self, repos: List[Dict]) -> str:
"""Generate main index page"""
- current_time = datetime.datetime.now(datetime.timezone.utc)
+ current_time = datetime.datetime.now()
time_str = current_time.strftime('%Y-%m-%d %H:%M:%S %z')
html_fragments = [
@@ -302,6 +302,19 @@ class HTMLGenerator:
for repo in repos:
last_commit = repo.get('latest_commit', {})
last_commit_date = last_commit.get('date', 'N/A')[:10] if last_commit and last_commit.get('date') else 'N/A'
+
+ # Simple date check: colour green if last commit is 31 days or newer
+ date_style = ""
+ if last_commit_date != 'N/A':
+ try:
+ # Parse just the %Y-%m-%d portion
+ commit_date = datetime.datetime.strptime(last_commit_date, "%Y-%m-%d")
+ age_days = (current_time - commit_date).days
+ if age_days <= 31:
+ date_style = ' style="color: #00cd00; font-weight: bold;"'
+ except (ValueError, TypeError):
+ pass
+
html_fragments.append(f"""
<tr>
<td class="repo-name">
@@ -311,7 +324,7 @@ class HTMLGenerator:
</td>
<td class="repo-description">{repo['description_escaped']}</td>
<td class="repo-owner">{repo['owner_escaped']}</td>
- <td class="repo-last-commit">{last_commit_date}</td>
+ <td class="repo-last-commit"{date_style}>{last_commit_date}</td>
</tr>
""")