main: handle command args for blog building
crispy-caesus crispy@crispy-caesus.eu
Fri, 20 Mar 2026 02:14:51 +0100
1 files changed,
7 insertions(+),
1 deletions(-)
jump to
M
cmd/server/main.go
→
cmd/server/main.go
@@ -4,6 +4,7 @@ import (
"fmt" "log" "net/http" + "os" ) func handler(w http.ResponseWriter, r *http.Request) {@@ -15,8 +16,13 @@ log.Print(title)
http.ServeFile(w, r, "html/"+title+".html") } +func main() { + // generate blog pages + if len(os.Args) == 2 && os.Args[1] == "blog" { + generateBlog() + return + } -func main() { fs := http.FileServer(http.Dir("static")) http.Handle("/static/", http.StripPrefix("/static/", fs))