summaryrefslogtreecommitdiffstats
path: root/src/column.rs
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-02-09 16:33:27 +0000
committerBen S <ogham@bsago.me>2015-02-09 16:33:27 +0000
commit0d25a90ef1345a86dd73eae601f642d981dd5224 (patch)
tree1efcea5ed7287d6ecd028135f931338494322ee4 /src/column.rs
parent3289b82e2f071373b873056d903a00dfbc633fc1 (diff)
Initial work on date/time columns for files
Using the datetime crate, add an extra column to the --long view that prints out the modified, accessed, or created timestamp for each file. Also, let the user pick which one they want to see based on the --time command-line option.
Diffstat (limited to 'src/column.rs')
-rw-r--r--src/column.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/column.rs b/src/column.rs
index 030570a..8b46d9c 100644
--- a/src/column.rs
+++ b/src/column.rs
@@ -2,12 +2,13 @@ use std::iter::repeat;
use ansi_term::Style;
-use options::SizeFormat;
+use options::{SizeFormat, TimeType};
#[derive(PartialEq, Debug, Copy)]
pub enum Column {
Permissions,
FileSize(SizeFormat),
+ Timestamp(TimeType),
Blocks,
User,
Group,
@@ -42,14 +43,15 @@ impl Column {
/// to have a header row printed.
pub fn header(&self) -> &'static str {
match *self {
- Column::Permissions => "Permissions",
- Column::FileSize(_) => "Size",
- Column::Blocks => "Blocks",
- Column::User => "User",
- Column::Group => "Group",
- Column::HardLinks => "Links",
- Column::Inode => "inode",
- Column::GitStatus => "Git",
+ Column::Permissions => "Permissions",
+ Column::FileSize(_) => "Size",
+ Column::Timestamp(t) => t.header(),
+ Column::Blocks => "Blocks",
+ Column::User => "User",
+ Column::Group => "Group",
+ Column::HardLinks => "Links",
+ Column::Inode => "inode",
+ Column::GitStatus => "Git",
}
}
}