INNER CODE UNIT · Go
main
edgelesssys/constellation · hack/clidocgen/main.go:22
func main() {
cobra.EnableCommandSorting = false
rootCmd := cmd.NewRootCmd()
rootCmd.DisableAutoGenTag = true
// Generate Markdown for all commands.
cmdList := &bytes.Buffer{}
body := &bytes.Buffer{}
for _, c := range allSubCommands(rootCmd) {
if c.Hidden {
continue
}
name := c.Name()
fullName, level := determineFullNameAndLevel(c)
// First two arguments are used to create indentation for nested commands (2 spaces per level).
fmt.Fprintf(cmdList, "%*s* [%v](#constellation-%v): %v\n", 2*level, "", name, fullName, c.Short)
if err := doc.GenMarkdown(c, body); err != nil {