// FlagDescription creates a flag description and adds a list of valid options (if any)
FlagDescription creates a flag description and adds a list of valid options (if any)
// FlagDescription creates a flag description and adds a list of valid options ( if any )
func FlagDescription(localizer localize.Localizer, messageID string, validOptions ...string) string {
	sort.Strings(validOptions)
	description := localizer.MustLocalize(messageID)
	var chooseFrom string
	if len(validOptions) > 0 {
		if description[len(description)-1:] != "." {
			description += "."
		}
		chooseFrom = localizer.MustLocalize("flag.common.chooseFrom")
		for i, val := range validOptions {
			chooseFrom += fmt.Sprintf("\"%v\"", val)
			if i < len(validOptions)-1 {
				chooseFrom += ", "
			}
		}
	}
	return fmt.Sprintf("%v %v", description, chooseFrom)
}
func FlagDescription ( localizer localize . Localizer , messageID string , validOptions ... string ) string { sort . Strings ( validOptions ) description := localizer . MustLocalize ( messageID ) var chooseFrom string if len ( validOptions ) > 0 { if description [ len ( description ) - 1 : ] != " " { description += " " } chooseFrom = localizer . MustLocalize ( " " ) for i , val := range validOptions { chooseFrom += fmt . Sprintf ( " \" \" " , val ) if i < len ( validOptions ) - 1 { chooseFrom += " " } } } return fmt . Sprintf ( " " , description , chooseFrom ) }
FlagDescription creates a flag description and adds a list of valid options (if any)
FlagDescription creates a flag description and adds a list of valid options ( if any )
// ensure consistent order