From ad8865dea8253277528acc5e1a8e5c92bbf316a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C4=87?= Date: Thu, 7 Aug 2025 22:17:11 +0200 Subject: [PATCH] Do not generate reference docs from the plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Kuć --- app/cli/documentation/generate.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/cli/documentation/generate.go b/app/cli/documentation/generate.go index c18f7b4e4..0dfb5cd85 100644 --- a/app/cli/documentation/generate.go +++ b/app/cli/documentation/generate.go @@ -55,7 +55,7 @@ func main() { var builder strings.Builder for _, subCmd := range command.Commands() { - if !subCmd.Hidden { + if !subCmd.Hidden && !isPluginCommand(subCmd) { // Start depth at 0 for subcommands generateCommandDocs(subCmd, &builder, 0) } @@ -82,7 +82,7 @@ func generateCommandDocs(cmd *cobra.Command, builder *strings.Builder, currentDe // Recursively process subcommands with increased depth for _, subCmd := range cmd.Commands() { - if !subCmd.Hidden { + if !subCmd.Hidden && !isPluginCommand(subCmd) { generateCommandDocs(subCmd, builder, currentDepth+1) } } @@ -148,6 +148,11 @@ func isUnderlineHeader(line string) bool { return regexp.MustCompile(`^[-=]+$`).MatchString(line) } +// isPluginCommand checks if a command is from a plugin by looking for the plugin signature in the Long description +func isPluginCommand(cmd *cobra.Command) bool { + return strings.Contains(cmd.Long, "Provided by plugin:") +} + // processFinalDocument cleans up the final document by removing excessive newlines and headers. func processFinalDocument(content string) string { // Clean up excessive newlines and leftover headers