Changeset 61 in code
Legend:
- Unmodified
- Added
- Removed
-
trunk/README.md
r56 r61 18 18 Build it manually assuming you have Go installed: 19 19 20 $ go install marisa.chaotic.ninja/aya @latest20 $ go install marisa.chaotic.ninja/aya/cmd/aya@latest 21 21 22 22 ## Ideology … … 67 67 "<item>" \ 68 68 "<title>$title</title>" \ 69 "<link>http:// ayaerge.com/$url</link>" \69 "<link>http://zserge.com/$url</link>" \ 70 70 "<description>$descr</description>" \ 71 71 "<pubDate>$(date --date @$timestamp -R)</pubDate>" \ 72 "<guid>http:// ayaerge.com/$url</guid>" \72 "<guid>http://zserge.com/$url</guid>" \ 73 73 "</item>" 74 74 fi … … 94 94 `aya build <file>` re-builds one file and prints resulting content to stdout. 95 95 96 `aya watch` rebuilds your site every time you modify any file.96 `aya serve` serves your site over HTTP. 97 97 98 98 `aya var <filename> [var1 var2...]` prints a list of variables defined in the … … 100 100 it's an empty string). 101 101 102 `aya watch` rebuilds your site every time you modify any file. 103 102 104 ## License 103 105 -
trunk/aya.1
r56 r61 17 17 .El 18 18 .Sh USAGE 19 .Ss (Re-)build your site. 20 .Nm 21 .Cm build 22 .Ss (Re-)build one file and prints resulting content to standard output. 19 .Bl -tag 20 .It build 21 (Re-)build a site or a file in particular 22 .It serve 23 Serve generated site over HTTP 24 .It var 25 Print a list of variables defined in a given markdown file. 26 .It watch 27 (Re-)build a site if any file changed 28 .Sh HISTORY 23 29 .Nm 24 .Cm build 25 .Ar <file> 26 .Ss (Re-)build your site every time you modify any file. 27 .Nm 28 .Cm watch 29 .Ss Print a list of variables defined in the header of a given markdown file. 30 .Nm 31 .Cm var 32 .Ar <file> 33 .Ar <var1> <var2> ... 30 was originally forked from prologic/zs by Izuru 31 out of disgust with the latest revision, so he 32 used a earlier commit as a base, and then 33 eventually reimplemented older features from 34 zserge's original project. 34 35 .Sh AUTHORS 35 36 .Nm -
trunk/cmd/aya/main.go
r60 r61 5 5 "fmt" 6 6 "io" 7 " io/ioutil"7 "net/http" 8 8 "os" 9 9 "os/exec" … … 60 60 func run(vars Vars, cmd string, args ...string) (string, error) { 61 61 // First check if partial exists (.html) 62 if b, err := ioutil.ReadFile(filepath.Join(AYADIR, cmd+".html")); err == nil {62 if b, err := os.ReadFile(filepath.Join(AYADIR, cmd+".html")); err == nil { 63 63 return string(b), nil 64 64 } … … 91 91 // If no empty newline is found - file is treated as content-only. 92 92 func getVars(path string, globals Vars) (Vars, string, error) { 93 b, err := ioutil.ReadFile(path)93 b, err := os.ReadFile(path) 94 94 if err != nil { 95 95 return nil, "", err … … 360 360 } 361 361 } 362 // Serve the public directory over HTTP 363 func servePubDir() { 364 rootdir := http.Dir(PUBDIR) 365 http.Handle("/", http.FileServer(rootdir)) 366 log.Fatal(http.ListenAndServe(":8000", nil)) 367 } 362 368 363 369 func init() { … … 373 379 fmt.Printf("Where <command> is:\n") 374 380 fmt.Printf("\tbuild\tGenerate site\n") 381 fmt.Printf("\tserve\tServe %v over HTTP\n", PUBDIR) 382 fmt.Printf("\tvar\tQuery variable(s) from a markdown file\n") 383 fmt.Printf("\tversion\tPrint program version and exit\n") 375 384 fmt.Printf("\twatch\t(Re)generate site while looking for changes\n") 376 fmt.Printf("\tvar\tQuery a variable from a markdown file\n")377 fmt.Printf("\tversion\tPrint version and exit\n")378 385 fmt.Printf("\n") 379 386 fmt.Printf("Other commands may be dynamically added by plugins found in %v\n", AYADIR) … … 398 405 fmt.Println("ERROR: too many arguments") 399 406 } 400 case " watch":401 buildAll(true)407 case "serve": 408 servePubDir() 402 409 case "var": 403 410 if len(args) == 0 { … … 421 428 } 422 429 case "version": 423 fmt.Printf("%v\n", aya. Version)430 fmt.Printf("%v\n", aya.FullVersion()) 424 431 os.Exit(0) 432 case "watch": 433 buildAll(true) 425 434 default: 426 435 if s, err := run(globals(), cmd, args...); err != nil {
Note:
See TracChangeset
for help on using the changeset viewer.