diff --git a/src/main.rs b/src/main.rs index 5481360a5c..68c244bf8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,7 +49,8 @@ fn main() -> Result<(), Box> { let h = crate::shell::Helper::new(); let mut rl: Editor = Editor::with_config(config); - if cfg!(windows) { + #[cfg(windows)] + { let _ = ansi_term::enable_ansi_support(); } diff --git a/src/object/base.rs b/src/object/base.rs index 63615814fe..eac093cd05 100644 --- a/src/object/base.rs +++ b/src/object/base.rs @@ -54,6 +54,8 @@ pub enum Value { Primitive(Primitive), Object(crate::object::Dictionary), List(Vec), + + #[allow(unused)] Error(Box), } @@ -149,11 +151,11 @@ impl Value { Value::Primitive(Primitive::Boolean(s.into())) } - #[allow(unused)] crate fn system_date(s: SystemTime) -> Value { Value::Primitive(Primitive::Date(s.into())) } + #[allow(unused)] crate fn system_date_result(s: Result) -> Value { match s { Ok(time) => Value::Primitive(Primitive::Date(time.into())), diff --git a/src/object/files.rs b/src/object/files.rs index 6c07079f73..55faf6d451 100644 --- a/src/object/files.rs +++ b/src/object/files.rs @@ -32,9 +32,20 @@ crate fn dir_entry_dict(entry: &std::fs::DirEntry) -> Result dict.add("created", Value::system_date(c)), + Err(_) => {} + } + + match metadata.accessed() { + Ok(a) => dict.add("accessed", Value::system_date(a)), + Err(_) => {} + } + + match metadata.modified() { + Ok(m) => dict.add("modified", Value::system_date(m)), + Err(_) => {} + } Ok(dict) }