summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenji Nguyen <45523555+solidiquis@users.noreply.github.com>2023-08-10 12:04:30 -0700
committerGitHub <noreply@github.com>2023-08-10 12:04:30 -0700
commitcfca1e6e5f6ef8221b95ebf9392d5787c87b030d (patch)
treecd7332afe99d2da62f8101264c447d6d78e613aa
parent07b7017c09bfdcfb7e969e968c534267506f3716 (diff)
parentc2c2c83af1f135cc8c505cbec6ad23e0bd58f76a (diff)
Merge pull request #233 from solidiquis/sort-definition-fix
fix sort definitions
-rw-r--r--src/context/sort.rs6
-rw-r--r--src/main.rs2
-rw-r--r--src/tree/mod.rs4
-rw-r--r--src/tree/node/cmp.rs22
4 files changed, 17 insertions, 17 deletions
diff --git a/src/context/sort.rs b/src/context/sort.rs
index 60a34a6..b7d9043 100644
--- a/src/context/sort.rs
+++ b/src/context/sort.rs
@@ -16,20 +16,26 @@ pub enum Type {
Rsize,
/// Sort entries by newer to older Accessing Date
+ #[value(alias("atime"))]
Access,
/// Sort entries by older to newer Accessing Date
+ #[value(alias("ratime"))]
Raccess,
/// Sort entries by newer to older Creation Date
+ #[value(alias("ctime"))]
Create,
/// Sort entries by older to newer Creation Date
+ #[value(alias("rctime"))]
Rcreate,
/// Sort entries by newer to older Alteration Date
+ #[value(alias("mtime"))]
Mod,
/// Sort entries by older to newer Alteration Date
+ #[value(alias("rmtime"))]
Rmod,
}
diff --git a/src/main.rs b/src/main.rs
index fb203a7..e66ca5f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -10,7 +10,7 @@
clippy::style,
clippy::suspicious
)]
-#![allow(clippy::cast_precision_loss, clippy::struct_excessive_bools)]
+#![allow(clippy::cast_precision_loss, clippy::struct_excessive_bools, clippy::wildcard_imports)]
use clap::CommandFactory;
use context::{layout, Context};
diff --git a/src/tree/mod.rs b/src/tree/mod.rs
index f4c4845..7e32fa6 100644
--- a/src/tree/mod.rs
+++ b/src/tree/mod.rs
@@ -221,10 +221,6 @@ impl Tree {
let node = tree[index].get();
- #[cfg(unix)]
- Self::update_column_properties(column_properties, node, ctx);
-
- #[cfg(not(unix))]
Self::update_column_properties(column_properties, node, ctx);
// If a hard-link is already accounted for then don't increment parent dir size.
diff --git a/src/tree/node/cmp.rs b/src/tree/node/cmp.rs
index cac2bda..9535b2b 100644
--- a/src/tree/node/cmp.rs
+++ b/src/tree/node/cmp.rs
@@ -63,16 +63,18 @@ fn base_comparator(sort_type: sort::Type) -> Box<NodeComparator> {
}
mod time_stamping {
+ pub(self) use crate::tree::node::Node;
+ pub(self) use core::cmp::Ordering;
+ pub(self) use std::time::SystemTime;
+
pub mod accessed {
- use crate::tree::node::Node;
- use core::cmp::Ordering;
- use std::time::SystemTime;
+ use super::*;
/// Comparator that sorts [Node]s by Last Access timestamp, newer to older.
pub fn comparator(a: &Node, b: &Node) -> Ordering {
let a_stamp = a.accessed().unwrap_or_else(SystemTime::now);
let b_stamp = b.accessed().unwrap_or_else(SystemTime::now);
- a_stamp.cmp(&b_stamp)
+ b_stamp.cmp(&a_stamp)
}
/// Comparator that sorts [Node]s by Access timestamp, older to newer.
@@ -82,15 +84,13 @@ mod time_stamping {
}
pub mod created {
- use crate::tree::node::Node;
- use core::cmp::Ordering;
- use std::time::SystemTime;
+ use super::*;
/// Comparator that sorts [Node]s by Creation timestamp, newer to older.
pub fn comparator(a: &Node, b: &Node) -> Ordering {
let a_stamp = a.created().unwrap_or_else(SystemTime::now);
let b_stamp = b.created().unwrap_or_else(SystemTime::now);
- a_stamp.cmp(&b_stamp)
+ b_stamp.cmp(&a_stamp)
}
/// Comparator that sorts [Node]s by Creation timestamp, older to newer.
@@ -100,15 +100,13 @@ mod time_stamping {
}
pub mod modified {
- use crate::tree::node::Node;
- use core::cmp::Ordering;
- use std::time::SystemTime;
+ use super::*;
/// Comparator that sorts [Node]s by Alteration timestamp, newer to older.
pub fn comparator(a: &Node, b: &Node) -> Ordering {
let a_stamp = a.modified().unwrap_or_else(SystemTime::now);
let b_stamp = b.modified().unwrap_or_else(SystemTime::now);
- a_stamp.cmp(&b_stamp)
+ b_stamp.cmp(&a_stamp)
}
/// Comparator that sorts [Node]s by Alteration timestamp, older to newer.