From de81cfbfed500db158440f7ec6b29b54c24ea66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Mon, 15 Jul 2024 15:08:02 -0700 Subject: [PATCH] add by directory status sorting --- internal/tables/sorting/sorting.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/tables/sorting/sorting.go b/internal/tables/sorting/sorting.go index 64c9b5e..43cbc2f 100644 --- a/internal/tables/sorting/sorting.go +++ b/internal/tables/sorting/sorting.go @@ -13,11 +13,13 @@ const ( PathReverse Size SizeReverse + Directory + DirectoryReverse ) func (s Sorting) Next() Sorting { switch s { - case SizeReverse: + case DirectoryReverse: return Name default: return s + 1 @@ -27,7 +29,7 @@ func (s Sorting) Next() Sorting { func (s Sorting) Prev() Sorting { switch s { case Name: - return SizeReverse + return DirectoryReverse default: return s - 1 } @@ -51,6 +53,10 @@ func (s Sorting) String() string { return "size" case SizeReverse: return "size (r)" + case Directory: + return "directories first" + case DirectoryReverse: + return "directories last" default: return "0" } @@ -74,6 +80,10 @@ func (s Sorting) Sorter() func(a, b files.File) int { return files.SortBySize case SizeReverse: return files.SortBySizeReverse + case Directory: + return files.SortDirectoriesFirst + case DirectoryReverse: + return files.SortDirectoriesLast default: return files.SortByName }