INNER CODE UNIT · Go

walkCommands

dropbox/dbxcli · tools/gen-docs/main.go:103

func walkCommands(command *cobra.Command, fn func(*cobra.Command) error) error {
	if !command.IsAvailableCommand() || command.IsAdditionalHelpTopicCommand() {
		return nil
	}
	if err := fn(command); err != nil {
		return err
	}

	children := append([]*cobra.Command{}, command.Commands()...)
	sort.Slice(children, func(i, j int) bool {
		return children[i].Name() < children[j].Name()
	})
	for _, child := range children {
		if err := walkCommands(child, fn); err != nil {
			return err
		}
	}
	return nil

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…