Skip to content
Myr

improve time option usage (#645)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* improve time option usage

authored by gorogoroumaru · committed by GitHub · parent 1b4e1e9 · Browse files · 2 files+3 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+3 added−0 removed

  • other:+3 added−0 removed

2 files+3 added−0 removed

modified:src/filter/time.rs+1 added
10 unmodified lines
11 fn from_str(ref_time: &SystemTime, s: &str) -> Option<SystemTime> {12 humantime::parse_duration(s)13 .map(|duration| *ref_time - duration)14 .or_else(|_| humantime::parse_rfc3339_weak(s))15 .or_else(|_| humantime::parse_rfc3339_weak(&(s.to_owned() + " 00:00:00")))16 .ok()17 }1819 pub fn before(ref_time: &SystemTime, s: &str) -> Option<TimeFilter> {
61 unmodified lines
modified:src/app.rs+2 added
410 unmodified lines
411 .arg(412 Arg::with_name("changed-within")413 .long("changed-within")414 .alias("change-newer-than")415 .alias("newer")416 .takes_value(true)417 .value_name("date|dur")418 .number_of_values(1)419 .help("Filter by file modification time (newer than)")
9 unmodified lines
429 .arg(430 Arg::with_name("changed-before")431 .long("changed-before")432 .alias("change-older-than")433 .alias("older")434 .takes_value(true)435 .value_name("date|dur")436 .number_of_values(1)437 .help("Filter by file modification time (older than)")
137 unmodified lines