aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/gen_manpage.go15
-rw-r--r--doc/gen_markdown.go20
2 files changed, 29 insertions, 6 deletions
diff --git a/doc/gen_manpage.go b/doc/gen_manpage.go
index 4147d915..0c7a501a 100644
--- a/doc/gen_manpage.go
+++ b/doc/gen_manpage.go
@@ -7,6 +7,7 @@ import (
"log"
"os"
"path"
+ "path/filepath"
"github.com/MichaelMure/git-bug/commands"
"github.com/spf13/cobra/doc"
@@ -14,7 +15,7 @@ import (
func main() {
cwd, _ := os.Getwd()
- filepath := path.Join(cwd, "doc", "man")
+ dir := path.Join(cwd, "doc", "man")
header := &doc.GenManHeader{
Title: "GIT-BUG",
@@ -24,7 +25,17 @@ func main() {
fmt.Println("Generating manpage ...")
- err := doc.GenManTree(commands.RootCmd, header, filepath)
+ 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)
}
diff --git a/doc/gen_markdown.go b/doc/gen_markdown.go
index ee87d544..47194666 100644
--- a/doc/gen_markdown.go
+++ b/doc/gen_markdown.go
@@ -4,20 +4,32 @@ package main
import (
"fmt"
- "github.com/MichaelMure/git-bug/commands"
- "github.com/spf13/cobra/doc"
"log"
"os"
"path"
+ "path/filepath"
+
+ "github.com/MichaelMure/git-bug/commands"
+ "github.com/spf13/cobra/doc"
)
func main() {
cwd, _ := os.Getwd()
- filepath := path.Join(cwd, "doc", "md")
+ dir := path.Join(cwd, "doc", "md")
fmt.Println("Generating Markdown documentation ...")
- err := doc.GenMarkdownTree(commands.RootCmd, filepath)
+ 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)
if err != nil {
log.Fatal(err)
}