git-bug/doc/gen_markdown.go

37 lines
553 B
Go
Raw Normal View History

2018-07-20 16:46:14 +03:00
// +build ignore
package main
import (
"fmt"
"log"
"os"
"path"
2019-02-23 15:02:18 +03:00
"path/filepath"
"github.com/MichaelMure/git-bug/commands"
"github.com/spf13/cobra/doc"
2018-07-20 16:46:14 +03:00
)
func main() {
cwd, _ := os.Getwd()
2019-02-23 15:02:18 +03:00
dir := path.Join(cwd, "doc", "md")
2018-07-20 16:46:14 +03:00
fmt.Println("Generating Markdown documentation ...")
2019-02-23 15:02:18 +03:00
files, err := filepath.Glob(dir + "/*.md")
if err != nil {
log.Fatal(err)
}
for _, f := range files {
if err := os.Remove(f); err != nil {
log.Fatal(err)
}
}
err = doc.GenMarkdownTree(commands.RootCmd, dir)
2018-07-20 16:46:14 +03:00
if err != nil {
log.Fatal(err)
}
}