Don't take case in count when sorting non-ordered vector flag
Fixes: https://gitlab.cri.epita.fr/ing/majeures/srs/fic/server/-/issues/30
This commit is contained in:
parent
20272e7bad
commit
6fd14306e1
@ -67,7 +67,10 @@ func getRawKey(input interface{}, validatorRe string, ordered bool, showLines bo
|
||||
|
||||
ignord := "f"
|
||||
if !ordered {
|
||||
sort.Strings(fitems)
|
||||
// Sort the list without taking the case in count.
|
||||
sort.Slice(fitems, func(i, j int) bool {
|
||||
return strings.ToLower(fitems[i]) < strings.ToLower(fitems[j])
|
||||
})
|
||||
ignord = "t"
|
||||
}
|
||||
|
||||
|
@ -80,9 +80,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Sort cells
|
||||
// Sort cells (case doesn't count in sort)
|
||||
if (flag.ignore_order) {
|
||||
v = v.sort();
|
||||
v = v.sort((a,b) => {
|
||||
const aUC = a.toUpperCase();
|
||||
const bUC = b.toUpperCase();
|
||||
if (aUC < bUC) {
|
||||
return -1;
|
||||
}
|
||||
if (aUC > bUC) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
value = v.join(flag.separator ? flag.separator : ',');
|
||||
|
Loading…
x
Reference in New Issue
Block a user