summaryrefslogtreecommitdiffstats
path: root/src/sort.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sort.rs')
-rw-r--r--src/sort.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/sort.rs b/src/sort.rs
index 91ac29b..abcf0cc 100644
--- a/src/sort.rs
+++ b/src/sort.rs
@@ -152,3 +152,21 @@ impl SortKind {
}
}
}
+
+impl std::fmt::Display for SortKind {
+ fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+ let s = match (&self.sort_by, &self.order) {
+ (SortBy::Exte, Order::Ascending) => "Exte ↑",
+ (SortBy::Exte, Order::Descending) => "Exte ↓",
+ (SortBy::Date, Order::Ascending) => "Date ↑",
+ (SortBy::Date, Order::Descending) => "Date ↓",
+ (SortBy::File, Order::Ascending) => "Name ↑",
+ (SortBy::File, Order::Descending) => "Name ↓",
+ (SortBy::Size, Order::Ascending) => "Size ↑",
+ (SortBy::Size, Order::Descending) => "Size ↓",
+ (SortBy::Kind, Order::Ascending) => "Kind ↑",
+ (SortBy::Kind, Order::Descending) => "Kind ↓",
+ };
+ write!(f, "{}", s)
+ }
+}