blob: cab9fcc84f9a05e90f6bb84fa7e7bcc14181e2aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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)
}
|