mirror of
https://github.com/Jguer/yay.git
synced 2026-02-17 13:52:14 +01:00
* Add all sortyby options Previously, only 'name' was a supported sortby option. Now, all sortby options are supported. Whenever there is a tie, the metric is used as a tiebreaker (it is also the default when sortby is not specified). The only behavior that changed is that packages with the same metric are sorted oppositely when sorting bottomUp. This was actually a bug in the previous implementation which inverts the `cmpResult` for bottomUp which returns true if the metrics are the same. According to the docs for Less (https://pkg.go.dev/sort#Interface), Less(i, i) should be false (the same element cannot sort before itself). I mainly structured the code for efficiency by creating the sortby function once rather than checking `separateSources` and `bottomUp` every comparison, but I also think this improves readability compared to having a switch-case in the comparison function. * Fix separating sources on ties and improve test coverage * Remove 'id' and 'baseid' in sortby options