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 3, 2019
1 parent b2992d9 commit 77b5b7c
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 77b5b7c

Please sign in to comment.