aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gen_manpage.go
blob: eef0ff66ec3d2de831a35fef08cc2446ce63f68f (plain) (blame)
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
45
46
// +build ignore

package main

import (
	"fmt"
	"log"
	"os"
	"path"
	"path/filepath"
	"time"

	"github.com/MichaelMure/git-bug/commands"
	"github.com/spf13/cobra/doc"
)

func main() {
	cwd, _ := os.Getwd()
	dir := path.Join(cwd, "doc", "man")

	date := time.Date(2019, 4, 1, 12, 0, 0, 0, time.UTC)

	header := &doc.GenManHeader{
		Title:   "GIT-BUG",
		Section: "1",
		Date:    &date,
		Source:  "Generated from git-bug's source code",
	}

	fmt.Println("Generating manpage ...")

	files, err := filepath.Glob(dir + "/*.1")
	if err != nil {
		log.Fatal(err)
	}
	for _, f := range files {
		if err := os.Remove(f); err != nil {
			log.Fatal(err)
		}
	}

	err = doc.GenManTree(commands.RootCmd, header, dir)
	if err != nil {
		log.Fatal(err)
	}
}