Skip to content

Commit

Permalink
Print where generated docs are written to
Browse files Browse the repository at this point in the history
  • Loading branch information
pwittrock committed Mar 21, 2018
1 parent 5765d1a commit d54b25c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions cmd/kubebuilder/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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"))
}

0 comments on commit d54b25c

Please sign in to comment.