main.go
// Command repoview is a tiny read-only web viewer for local source trees.
//
// Each configured root is served under its name as a URL prefix,
// e.g. "/moonshot-1/crates/iri/filetests/verify-errors.md".
// The default view is rendered (markdown becomes HTML, directories become listings);
// appending "?fmt=raw" serves the file bytes directly.
package main
import (
"flag"
"log"
"net/http"
)
// roots maps a URL name to a filesystem directory.
// Hardcoded for now; lift into a config file when we want more than a couple.
var roots = map[string]string{
"moonshot-1": "/home/exedev/fusion/moonshot-1",
}
func main() {
addr := flag.String("addr", ":8000", "listen address")
flag.Parse()
srv, err := newServer(roots)
if err != nil {
log.Fatal(err)
}
log.Printf("repoview listening on %s", *addr)
log.Fatal(http.ListenAndServe(*addr, srv))
}
main.go · 859 B · c213fcb807