Conversation
yevgenypats
left a comment
There was a problem hiding this comment.
Looks good. few minor comments.
docs/source.go
Outdated
|
|
||
| // GenerateSourcePluginDocs creates table documentation for the source plugin based on its list of tables | ||
| func GenerateSourcePluginDocs(p *plugins.SourcePlugin, outputPath string, deleteOld bool) error { | ||
| if deleteOld { |
There was a problem hiding this comment.
I think we should never delete files and it should be part of someone script if he wants to delete everything and regenerated
There was a problem hiding this comment.
@yevgenypats I agree, but this will lead to a lot of duplication since all the plugins will need this functionality, and we don't want them to share common libraries in the monorepo.
How about we remove the option here, but we add a convenience function for deleting directories to the SDK, maybe in another package?
There was a problem hiding this comment.
I added a helper function in this commit: 3ac2962
There was a problem hiding this comment.
I actually meant for us to something like rm -rf *.md && go run main.go doc so a helper function wont be needed because it highly depends on what is in the directory and specifaclly in our case what is in our website so it can also be something like rm -rf cloudquery*.md . I think in cobra there is also no logic around deleting - https://github.com/spf13/cobra/blob/main/doc/md_docs.go
There was a problem hiding this comment.
Ah I see! Okay yeah, makes sense. I'll remove the delete functionality from this PR and update the scripts to run something like rm -rf *.md in a follow-up where we migrate to this implementation.
| } | ||
|
|
||
| outputPath := filepath.Join(dir, fmt.Sprintf("%s.md", table.Name)) | ||
| f, err := os.Create(outputPath) |
There was a problem hiding this comment.
I think this should be truncated as a default behaviour.
There was a problem hiding this comment.
No change needed here I believe, os.Create creates or truncates the named file. If the file already exists, it is truncated.
Adds the ability to generate markdown docs for source plugins. Mostly migrated from
cq-provider-sdkwith minor tweaks and new tests.