feat: change sort col using two fixed keys
My attempt at this feature request: #1000
Description
Change the sort col using two fixed keys, < and >.
q changes the sort order. The behaviour is now similar to top
Demo
(The player doesn't show the key inputs sadly)
Implementation details
- Used the
qkey instead ofrbecause it is already used in some places (e.g. node drain). I assumed you do not want to change the default keybindings even though I am personally in favour of refactoring withr - I believe the sort implementation could benefit from a refactor. Currently, the values are sorted on the displayed string value. I took the inspiration from
ageto fix sorting oncapacity, but it isn't ideal. It can lead to issues like this too: #885. The original value or a specific compare function should be kept on the level of theFieldsor evenRow. - Not a Go dev, sorry upfront for non-idiomatic code
Closes #1000
This is a great improvement! Here's to hoping it can get merged.
What's the status of this? Any reason it couldn't be merged? In my case I'd love to order by assigned memory limit (not the percentage) which is not possible atm.
Rebased with small fixes here: https://github.com/derailed/k9s/pull/2739
@derailed This PR dates back to 2021 and k9s now supports asc/desc column sorting, the feature is largely covered. Due to current sorting limitations, it might still be worth revisiting this approach in the future.