Skip to content

Commit

Permalink
hack/generate/gen-cli-doc.go: un-revert cli generator
Browse files Browse the repository at this point in the history
  • Loading branch information
joelanford committed Dec 4, 2019
1 parent 7c75f90 commit 8d8e787
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions hack/generate/gen-cli-doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package main

import (
"os"

"github.com/operator-framework/operator-sdk/cmd/operator-sdk/cli"
"path/filepath"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra/doc"

"github.com/operator-framework/operator-sdk/cmd/operator-sdk/cli"
)

func main() {
Expand All @@ -32,7 +33,19 @@ func main() {
log.Fatalf("Failed to get current directory: %v", err)
}

err = doc.GenMarkdownTree(root, currentDir+"/doc/cli")
docPath := filepath.Join(currentDir, "doc", "cli")

// Remove and recreate the CLI doc directory to ensure that
// stale files (e.g. from renamed or removed CLI subcommands)
// are removed.
if err := os.RemoveAll(docPath); err != nil {
log.Fatalf("Failed to remove existing generated docs: %v", err)
}
if err := os.MkdirAll(docPath, 0755); err != nil {
log.Fatalf("Failed to re-create docs directory: %v", err)
}

err = doc.GenMarkdownTree(root, docPath)
if err != nil {
log.Fatalf("Failed to generate documentation: %v", err)
}
Expand Down

0 comments on commit 8d8e787

Please sign in to comment.