From 2e4e4b0d6f30d9d4612066395ba694c7c7d61e6e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 16 Apr 2021 16:10:27 -0700 Subject: lei q: --save preserves relative time queries Somebody may want a saved search which consistently asks for messages within a rolling time period window. In other words, we want to support using "lei q --save dt:last.week.." and keeps the "dt:last.week.." relative to whenever "lei up" is run. This ensures relative date-time specifications get used in the future rather than converting into an absolute date-time from the initial "lei q" invocation. --- lib/PublicInbox/LeiSavedSearch.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/LeiSavedSearch.pm') diff --git a/lib/PublicInbox/LeiSavedSearch.pm b/lib/PublicInbox/LeiSavedSearch.pm index 815008fd..e79cf76a 100644 --- a/lib/PublicInbox/LeiSavedSearch.pm +++ b/lib/PublicInbox/LeiSavedSearch.pm @@ -25,12 +25,13 @@ sub new { } else { # new saved search "lei q --save" my $saved_dir = $lei->store_path . '/../saved-searches/'; my (@name) = ($lei->{ovv}->{dst} =~ m{([\w\-\.]+)/*\z}); - push @name, to_filename($lei->{mset_opt}->{qstr}); + my $q = $lei->{mset_opt}->{q_raw} // die 'BUG: {q_raw} missing'; + my $q_raw_str = ref($q) ? "@$q" : $q; + push @name, to_filename($q_raw_str); $dir = $saved_dir . join('-', @name); require File::Path; File::Path::make_path($dir); # raises on error $self->{'-f'} = "$dir/lei.saved-search"; - my $q = $lei->{mset_opt}->{q_raw}; if (ref $q) { cfg_set($self, '--add', 'lei.q', $_) for @$q; } else { -- cgit v1.2.3-24-ge0c7