func UseOptionsTemplates(cmd *cobra.Command) { templater := &templater{ UsageTemplate: OptionsUsageTemplate(), HelpTemplate: OptionsHelpTemplate(), } cmd.SetUsageFunc(templater.UsageFunc()) cmd.SetHelpFunc(templater.HelpFunc()) }
func ActsAsRootCommand(cmd *cobra.Command, filters []string, groups ...CommandGroup) FlagExposer { if cmd == nil { panic("nil root command") } templater := &templater{ RootCmd: cmd, UsageTemplate: MainUsageTemplate(), HelpTemplate: MainHelpTemplate(), CommandGroups: groups, Filtered: filters, } cmd.SetUsageFunc(templater.UsageFunc()) cmd.SetHelpFunc(templater.HelpFunc()) return templater }