git-bug/doc/gen_manpage.go

43 lines
664 B
Go
Raw Normal View History

2018-07-20 16:47:06 +03:00
// +build ignore
package main
import (
"fmt"
"log"
"os"
"path"
2019-02-23 15:02:18 +03:00
"path/filepath"
2018-08-06 04:22:36 +03:00
"github.com/MichaelMure/git-bug/commands"
"github.com/spf13/cobra/doc"
2018-07-20 16:47:06 +03:00
)
func main() {
cwd, _ := os.Getwd()
2019-02-23 15:02:18 +03:00
dir := path.Join(cwd, "doc", "man")
2018-07-20 16:47:06 +03:00
header := &doc.GenManHeader{
2018-08-06 04:22:36 +03:00
Title: "GIT-BUG",
Section: "1",
2018-09-02 16:53:44 +03:00
Source: "Generated from git-bug's source code",
2018-07-20 16:47:06 +03:00
}
fmt.Println("Generating manpage ...")
2019-02-23 15:02:18 +03:00
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)
2018-07-20 16:47:06 +03:00
if err != nil {
log.Fatal(err)
}
}