@@ -61,13 +61,15 @@ var generateConfig bool
61
61
var cleanup , verbose bool
62
62
var outputDir string
63
63
var copyright string
64
+ var brodocs bool
64
65
65
66
func AddDocs (cmd * cobra.Command ) {
66
67
docsCmd .Flags ().BoolVar (& cleanup , "cleanup" , true , "If true, cleanup intermediary files" )
67
68
docsCmd .Flags ().BoolVar (& verbose , "verbose" , true , "If true, use verbose output" )
68
69
docsCmd .Flags ().BoolVar (& generateConfig , "generate-config" , true , "If true, generate the docs/reference/config.yaml." )
69
70
docsCmd .Flags ().StringVar (& outputDir , "output-dir" , filepath .Join ("docs" , "reference" ), "Build docs into this directory" )
70
71
docsCmd .Flags ().StringVar (& copyright , "copyright" , filepath .Join ("hack" , "boilerplate.go.txt" ), "Location of copyright boilerplate file." )
72
+ docsCmd .Flags ().BoolVar (& brodocs , "brodocs" , true , "Run brodocs to generate html." )
71
73
docsCmd .Flags ().StringVar (& generatecmd .Docscopyright , "docs-copyright" , "<a href=\" https://github.com/kubernetes/kubernetes\" >Copyright 2018 The Kubernetes Authors.</a>" , "html for the copyright text on the docs" )
72
74
docsCmd .Flags ().StringVar (& generatecmd .Docstitle , "title" , "API Reference" , "title of the docs page" )
73
75
cmd .AddCommand (docsCmd )
@@ -154,25 +156,26 @@ func RunDocs(cmd *cobra.Command, args []string) {
154
156
generatecmd .Codegenerators = []string {"apidocs" }
155
157
generatecmd .RunGenerate (cmd , args )
156
158
157
- // Run the docker command to build the docs
158
- c = exec .Command ("docker" , "run" ,
159
- "-v" , fmt .Sprintf ("%s:%s" , filepath .Join (wd , outputDir , "includes" ), "/source" ),
160
- "-v" , fmt .Sprintf ("%s:%s" , filepath .Join (wd , outputDir , "build" ), "/build" ),
161
- "-v" , fmt .Sprintf ("%s:%s" , filepath .Join (wd , outputDir , "build" ), "/build" ),
162
- "-v" , fmt .Sprintf ("%s:%s" , filepath .Join (wd , outputDir ), "/manifest" ),
163
- "gcr.io/kubebuilder/brodocs" ,
164
- )
165
- if verbose {
166
- log .Println (strings .Join (c .Args , " " ))
167
- c .Stderr = os .Stderr
168
- c .Stdout = os .Stdout
169
- }
170
- err = c .Run ()
171
- if err != nil {
172
- log .Fatalf ("error: %v\n " , err )
159
+ if brodocs {
160
+ // Run the docker command to build the docs
161
+ c = exec .Command ("docker" , "run" ,
162
+ "-v" , fmt .Sprintf ("%s:%s" , filepath .Join (wd , outputDir , "includes" ), "/source" ),
163
+ "-v" , fmt .Sprintf ("%s:%s" , filepath .Join (wd , outputDir , "build" ), "/build" ),
164
+ "-v" , fmt .Sprintf ("%s:%s" , filepath .Join (wd , outputDir , "build" ), "/build" ),
165
+ "-v" , fmt .Sprintf ("%s:%s" , filepath .Join (wd , outputDir ), "/manifest" ),
166
+ "gcr.io/kubebuilder/brodocs" ,
167
+ )
168
+ if verbose {
169
+ log .Println (strings .Join (c .Args , " " ))
170
+ c .Stderr = os .Stderr
171
+ c .Stdout = os .Stdout
172
+ }
173
+ err = c .Run ()
174
+ if err != nil {
175
+ log .Fatalf ("error: %v\n " , err )
176
+ }
177
+ fmt .Printf ("Reference docs written to %s\n " , filepath .Join (outputDir , "build" , "index.html" ))
173
178
}
174
-
175
- fmt .Printf ("Reference docs written to %s\n " , filepath .Join (outputDir , "build" , "index.html" ))
176
179
}
177
180
178
181
// Scaffolding file for writing the openapi generated structs to a swagger.json file
0 commit comments