github.com/cilium/cilium@v1.16.2/operator/cmd/cmdref.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package cmd 5 6 import ( 7 "fmt" 8 9 "github.com/spf13/cobra" 10 "github.com/spf13/cobra/doc" 11 ) 12 13 func linkHandler(s string) string { 14 return s 15 } 16 17 func filePrepend(s string) string { 18 // Prepend a HTML comment that this file is autogenerated. So that 19 // users are warned before fixing issues in the Markdown files. Should 20 // never show up on the web. 21 return fmt.Sprintf("%s\n\n", "<!-- This file was autogenerated via cilium-operator --cmdref, do not edit manually-->") 22 } 23 24 func genMarkdown(cmd *cobra.Command, cmdRefDir string) { 25 // Remove the line 'Auto generated by spf13/cobra on ...' 26 cmd.DisableAutoGenTag = true 27 if err := doc.GenMarkdownTreeCustom(cmd, cmdRefDir, filePrepend, linkHandler); err != nil { 28 log.Fatal(err) 29 } 30 }