func usageFunc(cmd *cobra.Command) error { subCommands := getSubCommands(cmd) commandUsageTemplate.Execute(tabOut, struct { Executable string Cmd *cobra.Command CmdFlags *pflag.FlagSet SubCommands []*cobra.Command }{ cliName, cmd, cmd.Flags(), subCommands, }) tabOut.Flush() return nil }