Remove year field on timestamp column

It's now in the locals of the Table struct, and didn't really belong in the column anyway.
This commit is contained in:
Ben S 2015-05-12 03:02:38 +01:00
parent 7f48748e70
commit 5af0f5793e
3 changed files with 22 additions and 26 deletions

View File

@ -11,7 +11,7 @@ use unicode_width::UnicodeWidthStr;
pub enum Column {
Permissions,
FileSize(SizeFormat),
Timestamp(TimeType, i64),
Timestamp(TimeType),
Blocks,
User,
Group,
@ -48,7 +48,7 @@ impl Column {
match *self {
Column::Permissions => "Permissions",
Column::FileSize(_) => "Size",
Column::Timestamp(t, _) => t.header(),
Column::Timestamp(t) => t.header(),
Column::Blocks => "Blocks",
Column::User => "User",
Column::Group => "Group",

View File

@ -15,8 +15,6 @@ use std::os::unix::fs::MetadataExt;
use getopts;
use natord;
use datetime::local::{LocalDateTime, DatePiece};
use self::Misfire::*;
/// The *Options* struct represents a parsed version of the user's
@ -555,18 +553,16 @@ impl Columns {
columns.push(Group);
}
let current_year = LocalDateTime::now().year();
if self.time_types.modified {
columns.push(Timestamp(TimeType::FileModified, current_year));
columns.push(Timestamp(TimeType::FileModified));
}
if self.time_types.created {
columns.push(Timestamp(TimeType::FileCreated, current_year));
columns.push(Timestamp(TimeType::FileCreated));
}
if self.time_types.accessed {
columns.push(Timestamp(TimeType::FileAccessed, current_year));
columns.push(Timestamp(TimeType::FileAccessed));
}
if cfg!(feature="git") {

View File

@ -185,7 +185,7 @@ impl Table {
match *column {
Column::Permissions => self.render_permissions(file.permissions()),
Column::FileSize(fmt) => self.render_size(file.size(), fmt),
Column::Timestamp(t, _) => self.render_time(file.timestamp(t)),
Column::Timestamp(t) => self.render_time(file.timestamp(t)),
Column::HardLinks => self.render_links(file.links()),
Column::Inode => self.render_inode(file.inode()),
Column::Blocks => self.render_blocks(file.blocks()),