Support a column shows time of modification

This commit is contained in:
Shunsuke Mie 2021-10-31 18:18:31 +09:00 committed by Arijit Basu
parent 09002d0e65
commit 57c29d47c5
2 changed files with 1181 additions and 0 deletions

1172
src/app.rs

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@ use crate::lua;
use crate::permissions::Permissions;
use ansi_to_tui_forked::ansi_to_text;
use anyhow::Result;
use chrono::{DateTime, Local};
use indexmap::IndexSet;
use lazy_static::lazy_static;
use mlua::Lua;
@ -375,6 +376,8 @@ pub struct ResolvedNodeUiMetadata {
pub mime_essence: String,
pub size: u64,
pub human_size: String,
pub last_modified: Option<DateTime<Local>>,
pub human_modified: String,
}
impl From<ResolvedNode> for ResolvedNodeUiMetadata {
@ -388,6 +391,8 @@ impl From<ResolvedNode> for ResolvedNodeUiMetadata {
mime_essence: node.mime_essence.to_owned(),
size: node.size,
human_size: node.human_size,
last_modified: node.last_modified.to_owned(),
human_modified: node.human_modified,
}
}
}
@ -410,6 +415,8 @@ pub struct NodeUiMetadata {
pub permissions: Permissions,
pub canonical: Option<ResolvedNodeUiMetadata>,
pub symlink: Option<ResolvedNodeUiMetadata>,
pub last_modified: Option<DateTime<Local>>,
pub human_modified: String,
// Extra
pub index: usize,
@ -456,6 +463,8 @@ impl NodeUiMetadata {
permissions: node.permissions.to_owned(),
canonical: node.canonical.to_owned().map(ResolvedNode::into),
symlink: node.symlink.to_owned().map(ResolvedNode::into),
last_modified: node.last_modified.to_owned(),
human_modified: node.human_modified.to_owned(),
index,
relative_index,
is_before_focus,