Mercurial > yakumo_izuru > aya
changeset 77:e1f9fda6986a draft
Just a documentation update
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
author | yakumo.izuru |
---|---|
date | Sun, 10 Dec 2023 23:57:40 +0000 |
parents | e8eb1fdb4b03 |
children | 5583ff07e384 |
files | cmd/aya/main.go serve.go usage.go version.go |
diffstat | 4 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/cmd/aya/main.go Mon Dec 04 17:21:08 2023 +0000 +++ b/cmd/aya/main.go Sun Dec 10 23:57:40 2023 +0000 @@ -1,4 +1,4 @@ -// $TheSupernovaDuo: marisa.chaotic.ninja/aya/cmd/aya, v0.6.8 2023-12-04 15:43:44+0000, yakumo_izuru Exp $ +// $TheSupernovaDuo: marisa.chaotic.ninja/aya/cmd/aya, v0.6.9 2023-12-09 23:30:07+0000, yakumo_izuru Exp $ package main import ( @@ -199,7 +199,7 @@ return buildHTML(filepath.Join(AYADIR, v["layout"]), w, v) } -// Renders text file expanding all variable macros inside it +// Renders hypertext file expanding all variable macros inside it func buildHTML(path string, w io.Writer, vars Vars) error { v, body, err := getVars(path, vars) if err != nil { @@ -402,7 +402,7 @@ case "help": aya.PrintUsage() case "serve": - aya.HttpServe(PUBDIR) + aya.HttpServe(PUBDIR, 8000) case "var": if len(args) == 0 { fmt.Println("var: filename expected")
--- a/serve.go Mon Dec 04 17:21:08 2023 +0000 +++ b/serve.go Sun Dec 10 23:57:40 2023 +0000 @@ -29,10 +29,11 @@ log.Println(r.RemoteAddr, r.Method, rw.StatusCode, r.URL) } -func HttpServe(Dir string) { +// This function is called by the `aya serve` subcommand +func HttpServe(Dir string, Port int) { handler := &Handler{http.FileServer(http.Dir(Dir))} http.Handle("/", handler) - addr := fmt.Sprintf(":%d", 8000) + addr := fmt.Sprintf(":%d", Port) log.Printf("Listening on %s\n", addr) log.Fatal(http.ListenAndServe(addr, nil)) }