-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathautodocument.go
More file actions
42 lines (36 loc) · 1.15 KB
/
autodocument.go
File metadata and controls
42 lines (36 loc) · 1.15 KB
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
// Code generated by go-swagger; DO NOT EDIT.
package cli
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
"github.com/spf13/viper"
)
func makeMarkdownDocumentationCmd() *cobra.Command {
var markdownCmd = &cobra.Command{
Use: "markdown",
Short: "Generate markdown documentation (that you might be reading right now!!)",
Long: "Generate markdown documentation (that you might be reading right now!!)",
DisableFlagsInUseLine: true,
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
outDir := viper.GetString("markdown_dir")
err := os.MkdirAll(outDir, os.ModePerm)
if err != nil {
fmt.Printf("Error creating directory: %s\n", err)
os.Exit(1)
}
cmd.DisableAutoGenTag = true
err = doc.GenMarkdownTree(cmd.Root(), outDir)
if err != nil {
logDebugf("Error generating markdown: %s\n", err)
os.Exit(1)
}
logDebugf("Generated markdown successfully!")
},
}
return markdownCmd
}