Skip to content

Commit faedaea

Browse files
authored
Do not generate reference docs from the plugin (#2322)
Signed-off-by: Rafał Kuć <[email protected]>
1 parent 052fefa commit faedaea

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/cli/documentation/generate.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func main() {
5555

5656
var builder strings.Builder
5757
for _, subCmd := range command.Commands() {
58-
if !subCmd.Hidden {
58+
if !subCmd.Hidden && !isPluginCommand(subCmd) {
5959
// Start depth at 0 for subcommands
6060
generateCommandDocs(subCmd, &builder, 0)
6161
}
@@ -82,7 +82,7 @@ func generateCommandDocs(cmd *cobra.Command, builder *strings.Builder, currentDe
8282

8383
// Recursively process subcommands with increased depth
8484
for _, subCmd := range cmd.Commands() {
85-
if !subCmd.Hidden {
85+
if !subCmd.Hidden && !isPluginCommand(subCmd) {
8686
generateCommandDocs(subCmd, builder, currentDepth+1)
8787
}
8888
}
@@ -148,6 +148,11 @@ func isUnderlineHeader(line string) bool {
148148
return regexp.MustCompile(`^[-=]+$`).MatchString(line)
149149
}
150150

151+
// isPluginCommand checks if a command is from a plugin by looking for the plugin signature in the Long description
152+
func isPluginCommand(cmd *cobra.Command) bool {
153+
return strings.Contains(cmd.Long, "Provided by plugin:")
154+
}
155+
151156
// processFinalDocument cleans up the final document by removing excessive newlines and headers.
152157
func processFinalDocument(content string) string {
153158
// Clean up excessive newlines and leftover headers

0 commit comments

Comments
 (0)