func (i *Info) HelpWithSuperFlags(superF *gnuflag.FlagSet, f *gnuflag.FlagSet) []byte {
	buf := &bytes.Buffer{}
	fmt.Fprintf(buf, "Usage: %s", i.Name)
	hasOptions := false
	f.VisitAll(func(f *gnuflag.Flag) { hasOptions = true })
	if hasOptions {
		fmt.Fprintf(buf, " [%vs]", f.FlagKnownAs)
	}
	if i.Args != "" {
		fmt.Fprintf(buf, " %s", i.Args)
	}
	fmt.Fprintf(buf, "\n")
	if i.Purpose != "" {
		fmt.Fprintf(buf, "\nSummary:\n%s\n", strings.TrimSpace(i.Purpose))
	}
	hasSuperFlags := false
	if superF != nil && len(i.ShowSuperFlags) != 0 {
		filteredSuperF := gnuflag.NewFlagSetWithFlagKnownAs("", gnuflag.ContinueOnError, superF.FlagKnownAs)
		contains := func(one string) bool {
			for _, a := range i.ShowSuperFlags {
				if strings.ToLower(one) == strings.ToLower(a) {
					return true
				}
			}
			return false
		}
		superF.VisitAll(func(flag *gnuflag.Flag) {
			if contains(flag.Name) {
				hasSuperFlags = true
				filteredSuperF.Var(flag.Value, flag.Name, flag.Usage)
			}
		})
		if hasSuperFlags {
			fmt.Fprintf(buf, "\nGlobal %vs:\n", strings.Title(filteredSuperF.FlagKnownAs))
			filteredSuperF.SetOutput(buf)
			filteredSuperF.PrintDefaults()
			filteredSuperF.SetOutput(ioutil.Discard)
		}
	}

	if hasOptions {
		if hasSuperFlags {
			fmt.Fprintf(buf, "\nCommand %vs:\n", strings.Title(f.FlagKnownAs))
		} else {
			fmt.Fprintf(buf, "\n%vs:\n", strings.Title(f.FlagKnownAs))
		}
		f.SetOutput(buf)
		f.PrintDefaults()
	}
	f.SetOutput(ioutil.Discard)
	if i.Doc != "" {
		fmt.Fprintf(buf, "\nDetails:\n")
		fmt.Fprintf(buf, "%s\n", strings.TrimSpace(i.Doc))
	}
	if len(i.Aliases) > 0 {
		fmt.Fprintf(buf, "\nAliases: %s\n", strings.Join(i.Aliases, ", "))
	}
	return buf.Bytes()
}
// HelpWithSuperFlags renders i's content, along with documentation for any
// flags defined in both command and its super command flag sets.
// Only super command flags defined in i.ShowSuperFlags are displayed, if found.
HelpWithSuperFlags renders i's content, along with documentation for any
flags defined in both command and its super command flag sets.
Only super command flags defined in i.ShowSuperFlags are displayed, if found.
// HelpWithSuperFlags renders i ' s content along with documentation for any // flags defined in both command and its super command flag sets . // Only super command flags defined in i . ShowSuperFlags are displayed if found .
func (i *Info) HelpWithSuperFlags(superF *gnuflag.FlagSet, f *gnuflag.FlagSet) []byte {
	buf := &bytes.Buffer{}
	fmt.Fprintf(buf, "Usage: %s", i.Name)
	hasOptions := false
	f.VisitAll(func(f *gnuflag.Flag) { hasOptions = true })
	if hasOptions {
		fmt.Fprintf(buf, " [%vs]", f.FlagKnownAs)
	}
	if i.Args != "" {
		fmt.Fprintf(buf, " %s", i.Args)
	}
	fmt.Fprintf(buf, "\n")
	if i.Purpose != "" {
		fmt.Fprintf(buf, "\nSummary:\n%s\n", strings.TrimSpace(i.Purpose))
	}
	hasSuperFlags := false
	if superF != nil && len(i.ShowSuperFlags) != 0 {
		filteredSuperF := gnuflag.NewFlagSetWithFlagKnownAs("", gnuflag.ContinueOnError, superF.FlagKnownAs)
		contains := func(one string) bool {
			for _, a := range i.ShowSuperFlags {
				if strings.ToLower(one) == strings.ToLower(a) {
					return true
				}
			}
			return false
		}
		superF.VisitAll(func(flag *gnuflag.Flag) {
			if contains(flag.Name) {
				hasSuperFlags = true
				filteredSuperF.Var(flag.Value, flag.Name, flag.Usage)
			}
		})
		if hasSuperFlags {
			fmt.Fprintf(buf, "\nGlobal %vs:\n", strings.Title(filteredSuperF.FlagKnownAs))
			filteredSuperF.SetOutput(buf)
			filteredSuperF.PrintDefaults()
			filteredSuperF.SetOutput(ioutil.Discard)
		}
	}
	if hasOptions {
		if hasSuperFlags {
			fmt.Fprintf(buf, "\nCommand %vs:\n", strings.Title(f.FlagKnownAs))
		} else {
			fmt.Fprintf(buf, "\n%vs:\n", strings.Title(f.FlagKnownAs))
		}
		f.SetOutput(buf)
		f.PrintDefaults()
	}
	f.SetOutput(ioutil.Discard)
	if i.Doc != "" {
		fmt.Fprintf(buf, "\nDetails:\n")
		fmt.Fprintf(buf, "%s\n", strings.TrimSpace(i.Doc))
	}
	if len(i.Aliases) > 0 {
		fmt.Fprintf(buf, "\nAliases: %s\n", strings.Join(i.Aliases, ", "))
	}
	return buf.Bytes()
}
func ( i * Info ) HelpWithSuperFlags ( superF * gnuflag . FlagSet , f * gnuflag . FlagSet ) [ ] byte { buf := & bytes . Buffer { } fmt . Fprintf ( buf , " " , i . Name ) hasOptions := false f . VisitAll ( func ( f * gnuflag . Flag ) { hasOptions = true } ) if hasOptions { fmt . Fprintf ( buf , " " , f . FlagKnownAs ) } if i . Args != " " { fmt . Fprintf ( buf , " " , i . Args ) } fmt . Fprintf ( buf , " \n " ) if i . Purpose != " " { fmt . Fprintf ( buf , " \n \n \n " , strings . TrimSpace ( i . Purpose ) ) } hasSuperFlags := false if superF != nil && len ( i . ShowSuperFlags ) != 0 { filteredSuperF := gnuflag . NewFlagSetWithFlagKnownAs ( " " , gnuflag . ContinueOnError , superF . FlagKnownAs ) contains := func ( one string ) bool { for _ , a := range i . ShowSuperFlags { if strings . ToLower ( one ) == strings . ToLower ( a ) { return true } } return false } superF . VisitAll ( func ( flag * gnuflag . Flag ) { if contains ( flag . Name ) { hasSuperFlags = true filteredSuperF . Var ( flag . Value , flag . Name , flag . Usage ) } } ) if hasSuperFlags { fmt . Fprintf ( buf , " \n \n " , strings . Title ( filteredSuperF . FlagKnownAs ) ) filteredSuperF . SetOutput ( buf ) filteredSuperF . PrintDefaults ( ) filteredSuperF . SetOutput ( ioutil . Discard ) } } if hasOptions { if hasSuperFlags { fmt . Fprintf ( buf , " \n \n " , strings . Title ( f . FlagKnownAs ) ) } else { fmt . Fprintf ( buf , " \n \n " , strings . Title ( f . FlagKnownAs ) ) } f . SetOutput ( buf ) f . PrintDefaults ( ) } f . SetOutput ( ioutil . Discard ) if i . Doc != " " { fmt . Fprintf ( buf , " \n \n " ) fmt . Fprintf ( buf , " \n " , strings . TrimSpace ( i . Doc ) ) } if len ( i . Aliases ) > 0 { fmt . Fprintf ( buf , " \n \n " , strings . Join ( i . Aliases , " " ) ) } return buf . Bytes ( ) }
HelpWithSuperFlags renders i's content, along with documentation for any
flags defined in both command and its super command flag sets.
HelpWithSuperFlags renders i ' s content along with documentation for any flags defined in both command and its super command flag sets .