diff options
author | Ben S <ogham@bsago.me> | 2015-02-09 16:33:27 +0000 |
---|---|---|
committer | Ben S <ogham@bsago.me> | 2015-02-09 16:33:27 +0000 |
commit | 0d25a90ef1345a86dd73eae601f642d981dd5224 (patch) | |
tree | 1efcea5ed7287d6ecd028135f931338494322ee4 /src/column.rs | |
parent | 3289b82e2f071373b873056d903a00dfbc633fc1 (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.rs | 20 |
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", } } } |