const usageFmt … type NamedFlagSets … // FlagSet returns the flag set with the given name and adds it to the // ordered name list if it is not in there yet. func (nfs *NamedFlagSets) FlagSet(name string) *pflag.FlagSet { … } // PrintSections prints the given names flag sets in sections, with the maximal given column number. // If cols is zero, lines are not wrapped. func PrintSections(w io.Writer, fss NamedFlagSets, cols int) { … } // SetUsageAndHelpFunc set both usage and help function. // Print the flag sets we need instead of all of them. func SetUsageAndHelpFunc(cmd *cobra.Command, fss NamedFlagSets, cols int) { … }