mirror of
https://gitea.com/Sirherobrine23/tea.git
synced 2024-08-21 17:57:24 +00:00
chore(cli): upgrade urfave/cli to v2 version Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Andrew Thornton <art27@cantab.net>
30 lines
520 B
Go
30 lines
520 B
Go
package cli
|
|
|
|
import "unicode"
|
|
|
|
// lexicographicLess compares strings alphabetically considering case.
|
|
func lexicographicLess(i, j string) bool {
|
|
iRunes := []rune(i)
|
|
jRunes := []rune(j)
|
|
|
|
lenShared := len(iRunes)
|
|
if lenShared > len(jRunes) {
|
|
lenShared = len(jRunes)
|
|
}
|
|
|
|
for index := 0; index < lenShared; index++ {
|
|
ir := iRunes[index]
|
|
jr := jRunes[index]
|
|
|
|
if lir, ljr := unicode.ToLower(ir), unicode.ToLower(jr); lir != ljr {
|
|
return lir < ljr
|
|
}
|
|
|
|
if ir != jr {
|
|
return ir < jr
|
|
}
|
|
}
|
|
|
|
return i < j
|
|
}
|