Skip to content

Commit

Permalink
refactor(generator.go): modularize the check folder
Browse files Browse the repository at this point in the history
  • Loading branch information
TeoDev1611 committed May 31, 2021
1 parent b287fde commit 3d25216
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/doc-generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@ import (
"github.com/spf13/cobra/doc"
)

func GenDocTree(cmd *cobra.Command) {
func moldyDocFolder() {
_, err := os.Stat("moldyDoc")

if os.IsNotExist(err) {
errDir := os.MkdirAll("moldyDoc", 0755)
functions.CheckErrors(errDir, "Code 2", "Error in create the moldyDoc folder", "Report the error on github or re run with sudo")
}
}

func GenDocTree(cmd *cobra.Command) {
moldyDocFolder()
errDoc := doc.GenMarkdownTree(cmd, "./moldyDoc")
functions.CheckErrors(errDoc, "Code 2", "Error in generate the documentation for moldy", "Report the error on github or re run with sudo")
}

func DocCommand(cmd *cobra.Command) {
moldyDocFolder()
out := new(bytes.Buffer)
err := doc.GenMarkdown(cmd, out)
functions.CheckErrors(err, "Code 2", "Error in print out the doc for the command", "Report the error on github or re run with sudo")
Expand Down

0 comments on commit 3d25216

Please sign in to comment.