improve time option usage (#645)

* improve time option usage
This commit is contained in:
gorogoroumaru 2020-09-10 15:34:27 +09:00 committed by GitHub
parent 1b4e1e9c1a
commit 74c3431a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -412,6 +412,7 @@ pub fn build_app() -> App<'static, 'static> {
Arg::with_name("changed-within")
.long("changed-within")
.alias("change-newer-than")
.alias("newer")
.takes_value(true)
.value_name("date|dur")
.number_of_values(1)
@ -429,6 +430,7 @@ pub fn build_app() -> App<'static, 'static> {
Arg::with_name("changed-before")
.long("changed-before")
.alias("change-older-than")
.alias("older")
.takes_value(true)
.value_name("date|dur")
.number_of_values(1)

View File

@ -12,6 +12,7 @@ impl TimeFilter {
humantime::parse_duration(s)
.map(|duration| *ref_time - duration)
.or_else(|_| humantime::parse_rfc3339_weak(s))
.or_else(|_| humantime::parse_rfc3339_weak(&(s.to_owned() + " 00:00:00")))
.ok()
}