aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2020-01-28 22:06:16 +0100
committerEddy Pedroni <eddy@0xf7.com>2020-01-28 22:06:16 +0100
commit2c055e3ca001ee6064677a0db16172148e5edcef (patch)
tree46073b7ea2df58520ffc560af72ae2bdabf8bdd6 /main.go
parentce81b97e80ada42a223a7fd45c5abaa5c9667d75 (diff)
Added tentative page rendering, outline main function
Diffstat (limited to 'main.go')
-rw-r--r--main.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/main.go b/main.go
index 7905807..cab9fcc 100644
--- a/main.go
+++ b/main.go
@@ -1,5 +1,44 @@
package main
+import (
+ "fmt"
+ "os"
+)
+
+type templateData struct {
+ SiteTitle string
+ Pages map[string]page
+ Index int
+}
+
func main() {
+ // show usage if config file is missing
+ if len(os.Args) < 2 {
+ fmt.Println("Usage: godocs <config>")
+ os.Exit(1)
+ }
+
+ // read config file specified in the command line
+ cfg, err := readConfig(os.Args[1])
+ if err != nil {
+ panic(err)
+ }
+
+ // collect all entries
+ entries, err := findEntries(cfg)
+ if err != nil {
+ panic(err)
+ }
+
+ // render all entries
+ var pages = make(map[string]page)
+ for _, e := range entries {
+ fmt.Println("Processing page")
+ e.render(pages)
+ fmt.Println(pages)
+ fmt.Println("**************")
+ }
+ fmt.Println("----------------------------------------------------------------------------------------------")
+ fmt.Println(pages)
}