diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2020-01-28 22:06:16 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2020-01-28 22:06:16 +0100 |
commit | 2c055e3ca001ee6064677a0db16172148e5edcef (patch) | |
tree | 46073b7ea2df58520ffc560af72ae2bdabf8bdd6 /main.go | |
parent | ce81b97e80ada42a223a7fd45c5abaa5c9667d75 (diff) |
Added tentative page rendering, outline main function
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -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) } |