#!/usr/bin/python3 import os print("Content-type:text/plain\r\n\r\n", end="") # `ls -d /srv/git/*` config_filename = os.environ["GITWEB_CONFIG"] project_root = None remote_prefix = None with open(config_filename) as f: for line in f.readlines(): if line.startswith("$projectroot"): project_root = line.split('"')[1] elif line.startswith("$remote_prefix"): remote_prefix = line.split('"')[1] if project_root is not None or remote_prefix is not None: for file in os.scandir(project_root): desc=open(f"{file.path}/description").read() print(f"{file.name},{remote_prefix}{file.path},{desc}".strip())