( sys System, locale locale.Locale, sectionName string, options []*tsoptions.CommandLineOption, subCategory bool, beforeOptionsDescription, afterOptionsDescription *string, )
| 147 | } |
| 148 | |
| 149 | func generateSectionOptionsOutput( |
| 150 | sys System, |
| 151 | locale locale.Locale, |
| 152 | sectionName string, |
| 153 | options []*tsoptions.CommandLineOption, |
| 154 | subCategory bool, |
| 155 | beforeOptionsDescription, |
| 156 | afterOptionsDescription *string, |
| 157 | ) (output []string) { |
| 158 | output = append(output, createColors(sys).bold(sectionName), "\n", "\n") |
| 159 | |
| 160 | if beforeOptionsDescription != nil { |
| 161 | output = append(output, *beforeOptionsDescription, "\n", "\n") |
| 162 | } |
| 163 | if !subCategory { |
| 164 | output = append(output, generateGroupOptionOutput(sys, locale, options)...) |
| 165 | if afterOptionsDescription != nil { |
| 166 | output = append(output, *afterOptionsDescription, "\n", "\n") |
| 167 | } |
| 168 | return output |
| 169 | } |
| 170 | categoryMap := make(map[string][]*tsoptions.CommandLineOption) |
| 171 | var categoryOrder []string |
| 172 | for _, option := range options { |
| 173 | if option.Category == nil { |
| 174 | continue |
| 175 | } |
| 176 | curCategory := option.Category.Localize(locale) |
| 177 | if _, exists := categoryMap[curCategory]; !exists { |
| 178 | categoryOrder = append(categoryOrder, curCategory) |
| 179 | } |
| 180 | categoryMap[curCategory] = append(categoryMap[curCategory], option) |
| 181 | } |
| 182 | for _, key := range categoryOrder { |
| 183 | value := categoryMap[key] |
| 184 | output = append(output, "### ", key, "\n", "\n") |
| 185 | output = append(output, generateGroupOptionOutput(sys, locale, value)...) |
| 186 | } |
| 187 | if afterOptionsDescription != nil { |
| 188 | output = append(output, *afterOptionsDescription, "\n", "\n") |
| 189 | } |
| 190 | |
| 191 | return output |
| 192 | } |
| 193 | |
| 194 | func generateGroupOptionOutput(sys System, locale locale.Locale, optionsList []*tsoptions.CommandLineOption) []string { |
| 195 | var maxLength int |
no test coverage detected