Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
Improve Doc Generation (#294)
Browse files Browse the repository at this point in the history
Delete previous docs before regeneration
  • Loading branch information
bbernays authored Nov 24, 2021
1 parent f16316f commit a9cecc0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@ package main

import (
"fmt"
"io/ioutil"
"os"
"path"

"github.com/cloudquery/cq-provider-aws/resources"
"github.com/cloudquery/cq-provider-sdk/provider/docs"
)

func main() {
err := docs.GenerateDocs(resources.Provider(), "./docs")
outputPath := "./docs"
dir, err := ioutil.ReadDir(outputPath + "/tables")
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to generate docs: %s\n", err)
os.Exit(1)
}
for _, d := range dir {
if err := os.RemoveAll(path.Join([]string{outputPath + "/tables", d.Name()}...)); err != nil {
fmt.Fprintf(os.Stderr, "Failed to generate docs: %s\n", err)
os.Exit(1)
}

}

if err = docs.GenerateDocs(resources.Provider(), outputPath); err != nil {
fmt.Fprintf(os.Stderr, "Failed to generate docs: %s\n", err)
}
}

0 comments on commit a9cecc0

Please sign in to comment.