https://github.com/cilium/cilium
Raw File
Tip revision: 04a53146fec58788e3161114862f81c7270d1d53 authored by Martynas Pumputis on 21 March 2023, 09:54:45 UTC
WIP
Tip revision: 04a5314
cmdref.go
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium

package cmd

import (
	"fmt"

	"github.com/spf13/cobra"
	"github.com/spf13/cobra/doc"
)

func linkHandler(s string) string {
	return s
}

func filePrepend(s string) string {
	// Prepend a HTML comment that this file is autogenerated. So that
	// users are warned before fixing issues in the Markdown files.  Should
	// never show up on the web.
	return fmt.Sprintf("%s\n\n", "<!-- This file was autogenerated via cilium-operator --cmdref, do not edit manually-->")
}

func genMarkdown(cmd *cobra.Command, cmdRefDir string) {
	// Remove the line 'Auto generated by spf13/cobra on ...'
	cmd.DisableAutoGenTag = true
	if err := doc.GenMarkdownTreeCustom(cmd, cmdRefDir, filePrepend, linkHandler); err != nil {
		log.Fatal(err)
	}
}
back to top