summaryrefslogtreecommitdiffstats
path: root/src/cli.rs
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-06-02 13:03:07 +0200
committerMatthias Beyer <matthias.beyer@atos.net>2021-06-02 13:17:58 +0200
commit8cd7b44501d2843cfb2d9307ae2b83db15092028 (patch)
tree597c2acb9de9475de28e38cd365b8f84459dc17e /src/cli.rs
parentfb2aa81b6360acb7033488d0b042d3eddf25ad4b (diff)
Add ability to specify point in time in date filter argument
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cli.rs b/src/cli.rs
index ff7fcd8..e97308e 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1256,6 +1256,7 @@ fn arg_older_than_date(about: &str) -> Arg<'_> {
.about(about)
.long_about(r#"
DATE can be a freeform date, for example '2h'
+ It can also be a exact date: '2020-01-01 00:12:45'
Supported suffixes:
@@ -1285,6 +1286,7 @@ fn arg_newer_than_date(about: &str) -> Arg<'_> {
.about(about)
.long_about(r#"
DATE can be a freeform date, for example '2h'
+ It can also be a exact date: '2020-01-01 00:12:45'
Supported suffixes:
@@ -1305,7 +1307,14 @@ fn arg_newer_than_date(about: &str) -> Arg<'_> {
}
fn parse_date_from_string(s: &str) -> std::result::Result<(), String> {
- humantime::parse_duration(s).map_err(|e| e.to_string()).map(|_| ())
+ humantime::parse_duration(s)
+ .map_err(|e| e.to_string())
+ .map(|_| ())
+ .or_else(|_| {
+ humantime::parse_rfc3339_weak(s)
+ .map_err(|e| e.to_string())
+ .map(|_| ())
+ })
}
fn parse_usize(s: &str) -> std::result::Result<(), String> {