INNER CODE UNIT · Go

allSubCommands

edgelesssys/constellation · hack/clidocgen/main.go:50

func allSubCommands(cmd *cobra.Command) []*cobra.Command {
	var all []*cobra.Command
	for _, c := range cmd.Commands() {
		all = append(all, c)
		all = append(all, allSubCommands(c)...)
	}
	return all
}

func determineFullNameAndLevel(cmd *cobra.Command) (string, int) {
	// Traverse the command tree upwards and determine the full name and level of the command.
	name := cmd.Name()
	level := 0
	for cmd.HasParent() && cmd.Parent().Name() != "constellation" {
		cmd = cmd.Parent()
		name = cmd.Name() + "-" + name // Use '-' as separator since we pipe it into a Markdown link.
		level++
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…