From 9f07d940f6d02efe31c4c0f19781d14560e8c0a5 Mon Sep 17 00:00:00 2001 From: Izuru Yakumo Date: Sat, 16 Sep 2023 13:11:35 -0300 Subject: [PATCH] Fix a bug that I caused Signed-off-by: Izuru Yakumo --- aya.1 | 23 ++++++++++++++++------- cmd/aya/main.go | 27 ++++++++++++++------------- doc.go | 2 +- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/aya.1 b/aya.1 index 6f7983f..da2dc16 100644 --- a/aya.1 +++ b/aya.1 @@ -23,24 +23,33 @@ or a file in particular .It clean Removes the generated site directory +.It serve +Serves the .pub +directory over +HTTP .It var Print a list of variables defined in a given -markdown file +markdown file, +including empty +variables. .It watch (Re-)build a site if -any file changed and -serve it over HTTP +any file changed. .El .Sh HISTORY .Nm -was originally forked from prologic/zs by Izuru -out of disgust with the latest revision, so he -used a earlier commit as a base, and then +was originally forked from +prologic/zs by Izuru out of disgust +with the latest revision, so he used an +earlier commit as a base, and then eventually reimplemented older features from -zserge's original project. +the original project. .Sh AUTHORS .Nm is maintained by .An Izuru Yakumo .Aq Lk https://geidontei.chaotic.ninja/usr/yakumo_izuru/ +.Sh BUGS +Report them to this mailing list +.Mt devel@chaotic.ninja diff --git a/cmd/aya/main.go b/cmd/aya/main.go index 09d287d..9a9f907 100644 --- a/cmd/aya/main.go +++ b/cmd/aya/main.go @@ -1,4 +1,4 @@ -// $TheSupernovaDuo: cmd/aya/main.go,v 0.6.0 2023/9/13 07:50:00 yakumo_izuru Exp $ +// $TheSupernovaDuo: cmd/aya/main.go,v 0.6.1 2023/9/16 11:43:00 yakumo_izuru Exp $ package main import ( @@ -362,9 +362,11 @@ func buildAll(watch bool) { } } -// Serve the public directory over HTTP and watch for changes +// Serve the public directory over HTTP func serve() { - http.Handle("/", http.FileServer(http.Dir(PUBDIR))) + root := http.Dir(PUBDIR) + http.Handle("/", http.FileServer(root)) + log.Printf("Serving the %s directory over http://localhost:8000. Interrupt with ^C.\n", PUBDIR) log.Fatal(http.ListenAndServe(":8000", nil)) } @@ -378,16 +380,14 @@ func init() { // Print usage notes func printUsage() { - fmt.Printf("%v [args]\n", os.Args[0]) + fmt.Printf("Usage: %s [args]\n", os.Args[0]) + fmt.Printf("Where is one of\n") fmt.Printf("\n") - fmt.Printf("Where is:\n") - fmt.Printf("\tbuild\tGenerate site\n") - fmt.Printf("\tclean\tRemoves the generated site directory\n") - fmt.Printf("\tvar\tQuery variable(s) from a markdown file\n") - fmt.Printf("\tversion\tPrint program version and exit\n") - fmt.Printf("\twatch\t(Re)generate site while looking for changes (it also serves on HTTP)\n") - fmt.Printf("\n") - fmt.Printf("Other commands may be dynamically added by plugins found in %v\n", AYADIR) + fmt.Printf("\tbuild\t(Re-)builds site or a specific file\n") + fmt.Printf("\tclean\trm -rf %s\n", PUBDIR) + fmt.Printf("\tserve\tServes the %s directory over HTTP\n", PUBDIR) + fmt.Printf("\tvar\tPrint a list of variables defined in a given file, or values of certain variables\n") + fmt.Printf("\twatch\t(Re-)builds site and looks for changes\n") os.Exit(0) } @@ -413,6 +413,8 @@ func main() { os.RemoveAll(PUBDIR) case "help": printUsage() + case "serve": + serve() case "var": if len(args) == 0 { log.Fatal("var: filename expected") @@ -438,7 +440,6 @@ func main() { os.Exit(0) case "watch": buildAll(true) - serve() default: if s, err := run(globals(), cmd, args...); err != nil { log.Println(err) diff --git a/doc.go b/doc.go index 8ea58be..da7bc6d 100644 --- a/doc.go +++ b/doc.go @@ -1,3 +1,4 @@ +package aya // Package aya is [...] // Aya is the fastest static site generator @@ -17,4 +18,3 @@ // This one (re)incorporates the features removed in the former from the latter // Ayaya~ -package aya -- 2.43.0