diff --git a/cmd/aya/main.go b/cmd/aya/main.go index 6490370..ac22395 100644 --- a/cmd/aya/main.go +++ b/cmd/aya/main.go @@ -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 @@ func buildMarkdown(path string, w io.Writer, vars Vars) error { 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 @@ func main() { case "help": aya.PrintUsage() case "serve": - aya.HttpServe(PUBDIR) + aya.HttpServe(PUBDIR, 8000) case "var": if len(args) == 0 { fmt.Println("var: filename expected") diff --git a/serve.go b/serve.go index 36f7bcb..655793a 100644 --- a/serve.go +++ b/serve.go @@ -29,10 +29,11 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { 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)) } diff --git a/usage.go b/usage.go index 33facd1..75a9874 100644 --- a/usage.go +++ b/usage.go @@ -4,6 +4,7 @@ import ( "fmt" ) +// This function is called by the `aya help` subcommand func PrintUsage() { fmt.Printf("aya/%v\n", FullVersion()) fmt.Println("Homepage: https://aya.chaotic.ninja") diff --git a/version.go b/version.go index 467257e..30d5678 100644 --- a/version.go +++ b/version.go @@ -8,7 +8,7 @@ import ( var ( // Set to current tag - Version = "v0.6.8" + Version = "v0.6.9" Time = time.Now() )