sortFlags returns the flags as a slice in lexicographical sorted order.
(flags map[NormalizedName]*Flag)
| 227 | |
| 228 | // sortFlags returns the flags as a slice in lexicographical sorted order. |
| 229 | func sortFlags(flags map[NormalizedName]*Flag) []*Flag { |
| 230 | list := make(sort.StringSlice, len(flags)) |
| 231 | i := 0 |
| 232 | for k := range flags { |
| 233 | list[i] = string(k) |
| 234 | i++ |
| 235 | } |
| 236 | list.Sort() |
| 237 | result := make([]*Flag, len(list)) |
| 238 | for i, name := range list { |
| 239 | result[i] = flags[NormalizedName(name)] |
| 240 | } |
| 241 | return result |
| 242 | } |
| 243 | |
| 244 | // SetNormalizeFunc allows you to add a function which can translate flag names. |
| 245 | // Flags added to the FlagSet will be translated and then when anything tries to |
no test coverage detected