From d54b25cf2ebc8fb4637e9adccb52635c7c2aff4e Mon Sep 17 00:00:00 2001 From: Phillip Wittrock Date: Tue, 20 Mar 2018 23:43:33 -0700 Subject: [PATCH 1/2] Print where generated docs are written to --- cmd/kubebuilder/docs/docs.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/cmd/kubebuilder/docs/docs.go b/cmd/kubebuilder/docs/docs.go index f9ed9fcbf79..8dde74a9dd1 100644 --- a/cmd/kubebuilder/docs/docs.go +++ b/cmd/kubebuilder/docs/docs.go @@ -57,11 +57,12 @@ kubebuilder docs } var generateConfig bool -var cleanup bool +var cleanup, verbose bool var outputDir string func AddDocs(cmd *cobra.Command) { docsCmd.Flags().BoolVar(&cleanup, "cleanup", true, "If true, cleanup intermediary files") + docsCmd.Flags().BoolVar(&verbose, "verbose", true, "If true, use verbose output") docsCmd.Flags().BoolVar(&generateConfig, "generate-config", true, "If true, generate the docs/reference/config.yaml.") docsCmd.Flags().StringVar(&outputDir, "output-dir", filepath.Join("docs", "reference"), "Build docs into this directory") cmd.AddCommand(docsCmd) @@ -109,9 +110,11 @@ func RunDocs(cmd *cobra.Command, args []string) { "-e", "OUTPUT="+outputDir, "gcr.io/kubebuilder/gendocs", ) - log.Println(strings.Join(c.Args, " ")) - c.Stderr = os.Stderr - c.Stdout = os.Stdout + if verbose { + log.Println(strings.Join(c.Args, " ")) + c.Stderr = os.Stderr + c.Stdout = os.Stdout + } err = c.Run() if err != nil { log.Fatalf("error: %v\n", err) @@ -125,9 +128,11 @@ func RunDocs(cmd *cobra.Command, args []string) { "-v", fmt.Sprintf("%s:%s", filepath.Join(wd, outputDir), "/manifest"), "gcr.io/kubebuilder/brodocs", ) - log.Println(strings.Join(c.Args, " ")) - c.Stderr = os.Stderr - c.Stdout = os.Stdout + if verbose { + log.Println(strings.Join(c.Args, " ")) + c.Stderr = os.Stderr + c.Stdout = os.Stdout + } err = c.Run() if err != nil { log.Fatalf("error: %v\n", err) @@ -143,4 +148,6 @@ func RunDocs(cmd *cobra.Command, args []string) { os.RemoveAll(filepath.Join(wd, outputDir, "build", "runbrodocs.sh")) os.RemoveAll(filepath.Join(wd, outputDir, "build", "node_modules", "marked", "Makefile")) } + + fmt.Printf("Reference docs written to %s\n", filepath.Join(outputDir, "build", "index.html")) } From c342968d3e2caf758757b84a8f21dde3643492d9 Mon Sep 17 00:00:00 2001 From: Phillip Wittrock Date: Tue, 20 Mar 2018 23:43:57 -0700 Subject: [PATCH 2/2] Clean up docs generation md --- docs/creating_reference_documentation.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/creating_reference_documentation.md b/docs/creating_reference_documentation.md index 82c80fae22e..c4b715134b6 100644 --- a/docs/creating_reference_documentation.md +++ b/docs/creating_reference_documentation.md @@ -2,8 +2,12 @@ ## Build reference documentation -You may build Kubernetes style reference documentation for your APIs to `docs/reference/build/index.html` by -running `kubebuilder docs`. +You may build Kubernetes style reference documentation for your APIs to `docs/reference/build/index.html` + + +```go +kubebuilder docs +``` **Note:** There is currently an issue where building docs does not work if multiple versions of APIs for the same group are defined.