Consider case when sorting strings

This makes sorting flags and other sections consistent with how most
command line tools function, by placing both flags `-A` and `-a` before
a flag `-B`.
This commit is contained in:
Robert Liebowitz
2017-10-28 03:00:11 -04:00
parent 7bc6a0acff
commit b44660ac3d
5 changed files with 62 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ func (f FlagsByName) Len() int {
}
func (f FlagsByName) Less(i, j int) bool {
return f[i].GetName() < f[j].GetName()
return lexicographicLess(f[i].GetName(), f[j].GetName())
}
func (f FlagsByName) Swap(i, j int) {