diff options
author | Eric Wong <e@80x24.org> | 2021-02-10 18:57:58 -0100 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-11 19:15:05 +0000 |
commit | b503d87a23c90fc0f705a79bce34944e7e20b28b (patch) | |
tree | 73077711675b7b844a031acd2537a585addfac50 /lib/PublicInbox/LeiQuery.pm | |
parent | f310a5054fb8e215885f0b48afac44ff32ca1d56 (diff) | |
download | public-inbox-b503d87a23c90fc0f705a79bce34944e7e20b28b.tar.gz |
This greatly improves the usability of d:, dt:, and rt: search prefixes for users already familiar git's "approxidate" feature. That is, users familiar with the --(since|after|until|before)= options in git-log(1) and similar commands will be able to use those dates in the WWW UI.
Diffstat (limited to 'lib/PublicInbox/LeiQuery.pm')
-rw-r--r-- | lib/PublicInbox/LeiQuery.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index d637b1ae..f71beae6 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -14,7 +14,12 @@ sub prep_ext { # externals_each callback sub qstr_add { # for --stdin my ($self) = @_; # $_[1] = $rbuf if (defined($_[1])) { - return eval { $self->{lxs}->do_query($self) } if $_[1] eq ''; + $_[1] eq '' and return eval { + my $lse = delete $self->{lse}; + $lse->query_approxidate($lse->git, + $self->{mset_opt}->{qstr}); + $self->{lxs}->do_query($self); + }; $self->{mset_opt}->{qstr} .= $_[1]; } else { $self->fail("error reading stdin: $!"); @@ -105,6 +110,7 @@ sub lei_q { no query allowed on command-line with --stdin require PublicInbox::InputPipe; + $self->{lse} = $lse; # for query_approxidate PublicInbox::InputPipe::consume($self->{0}, \&qstr_add, $self); return; } |