diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-09 22:41:07 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-09 22:41:07 +0200 |
| commit | 1af7cf5fe51fa13e828cdef6268348ec9cd7bd7c (patch) | |
| tree | f8d28d4faa627b31175c0c39164c2ea84e022e90 /internal/tui/dashboard/sort.go | |
| parent | a4c72ad2cbe4ca857a5880675563b2ab4d24e1b5 (diff) | |
tui: add sortable files dashboard table modes (task 364)
Diffstat (limited to 'internal/tui/dashboard/sort.go')
| -rw-r--r-- | internal/tui/dashboard/sort.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/internal/tui/dashboard/sort.go b/internal/tui/dashboard/sort.go index acb19d0..5c4fe54 100644 --- a/internal/tui/dashboard/sort.go +++ b/internal/tui/dashboard/sort.go @@ -11,3 +11,36 @@ func (s tableSortState[K]) toggled(key K) tableSortState[K] { } return tableSortState[K]{active: true, key: key} } + +func compareUint64Desc(left, right uint64) int { + switch { + case left > right: + return -1 + case left < right: + return 1 + default: + return 0 + } +} + +func compareFloat64Desc(left, right float64) int { + switch { + case left > right: + return -1 + case left < right: + return 1 + default: + return 0 + } +} + +func compareStringAsc(left, right string) int { + switch { + case left < right: + return -1 + case left > right: + return 1 + default: + return 0 + } +} |
