hlfw.ca

hlfw

Download patch

ref: 2653af581dbd92b110a45b32d492c54fdc9c9464
parent: 750161b0281a7a9bc8c361d78d22789e55c17811
author: halfwit <halfwit@hlfw.ca>
date: Thu Aug 22 18:00:33 PDT 2024

Add gitlist

--- /dev/null
+++ b/gitlist
@@ -1,0 +1,44 @@
+#!/bin/rc -e
+
+. /sys/lib/hlfw/common.rc
+
+cd $1
+shift
+
+cache=/usr/web/cache/shitlist.cache
+tcache=/usr/web/cache/shitlist.cache.tmp.$pid
+if(test -e $cache && ! test $cache -older 1m){
+	exec cat $cache
+	exit
+}
+
+rfork ne
+nl='
+'
+
+{
+	prelude '' 'git host'
+	
+	udir=()
+	for(repo in `$nl{ls */}){
+		ndir=`{basename -d $repo}
+		if(! ~ $udir $ndir)
+			echo '</dl>'
+		if(! ~ $udir $ndir){
+			echo '<h3><a href="/git/'$ndir'/usr.html" name="'$ndir'">'$ndir'</a></h3>'
+			echo '<dl>'
+			udir=$ndir
+		}
+		if(test -e $repo/.git/webpublish){
+			echo '<dt><a href="/git/'$repo'/HEAD/info.html">'$repo'</a></dt>'
+			echo '<dd>'
+			if(test -f $repo/.git/desc)
+				htcat $repo/.git/desc
+			if not if(test -f $repo/.git/description)
+				htcat $repo/.git/description
+			if not
+				echo 'probably some code'
+			echo '</dd>'
+		}
+	}
+} | tee $tcache && mv $tcache $cache