shroomgit

generate static pages of git repos
git clone https://git.davidvoz.net/shroomgit.git
index
logs
tree
license

commit 5eb565ad1c03c380859ff3c253983151374c2147
Author: David Voznyarskiy <davidv@no-reply@disroot.org>
Date:   Thu Apr 16 21:56:52 2026 -0700

    make an icon art variable to be more customizable
    
    Signed-off-by: David Voznyarskiy <davidv@no-reply@disroot.org>

diff --git a/shgit/tree.go b/shgit/tree.go
index 0af71f4..6f7fa9b 100644
--- a/shgit/tree.go
+++ b/shgit/tree.go
@@ -87,8 +87,7 @@ func treeFiles(path string, output string, relPath string, repo string) { topPart := genTopPart(repo, depth+1) file.WriteString(topPart)
- // TODO handle images better
- // maybe try making a photos/ folder to hold it
+ // TODO handle binaries better
ex := filepath.Ext(path) if ex == ".png" || ex == ".jpg" || ex == ".webp" || ex == ".jpeg" { outputFile = filepath.Join(output, "media", relPath) @@ -113,7 +112,6 @@ func treeFiles(path string, output string, relPath string, repo string) { } func copyFile(src, dst string) error {
- // Ensure destination directory exists
if err := os.MkdirAll(filepath.Dir(dst), 0o755); err != nil { return err } @@ -135,5 +133,5 @@ func copyFile(src, dst string) error { return err }
- return out.Sync() // flush to disk
+ return out.Sync()
} diff --git a/shindex/config.go b/shindex/config.go index b4dd461..3472940 100644
--- a/shindex/config.go
+++ b/shindex/config.go
@@ -9,7 +9,6 @@ type config struct { desc string }
-// Shindex config
var shindex = config{ title: "Repositories", logo: "logo.png", @@ -18,3 +17,9 @@ var shindex = config{ logoHeight: 0, desc: "", }
+
+var repoIconArt = `
+<svg width="32" height="32">
+<rect x="6" y="10" width="20" height="20"
+fill="none" stroke="currentColor" stroke-width="2" transform="rotate(45 20 20)"/></svg>
+`
diff --git a/shindex/shindex.go b/shindex/shindex.go index ca8effd..91fad32 100644
--- a/shindex/shindex.go
+++ b/shindex/shindex.go
@@ -45,9 +45,8 @@ func gitTable(args []string) { // other instances of such a case would have to be changed as well fmt.Printf("<a href=\"%s/index.html\" style=\"color:inherit\">", repoName)
- fmt.Println("<svg width=\"32\" height=\"32\">")
- fmt.Println("<rect x=\"6\" y=\"10\" width=\"20\" height=\"20\"")
- fmt.Println("fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" transform=\"rotate(45 20 20)\"/></svg></a></div><div>")
+ fmt.Println(repoIconArt)
+ fmt.Println("</a></div><div>")
fmt.Printf("<a href=\"%s/index.html\" style=\"line-height:1.5;\">", repoName) fmt.Printf("<b>%s", repoName)